Develop new content type for xml to html translation (Drupal 6) What I would like to achieve is the this:


Develop new content type
Add two fields to the content type : XML, XSLT,  /  text areas
When I use this content type later on I want to be able to paste some XML into the XML field, some XSLT into the XSLT field. When I save my new content I want the XML to be translated into HTML.


So in view mode I would always see the HTML, 'edit' mode would give me away of manipulating the XML / XSLT

I started following this tutorial: http://drupal.org/node/231019. But that does not cover how /where to save my new fields.
This is how far I got following the tutorial:

/**
* Implementation of hook_node_info().
*/
function xmlparser_node_info() {
  return array (
    'node_amlparser'=&gt;array(
    'name'          =&gt; t('XML Parser'),
    'module'        =&gt; 'xmlparser',
    'description'   =&gt; 'This module takes XML and XSLT to generate HTML'
  )     
 );
}
/**
* Implementation of hook_perm().
*/  
function xmlparser_perm () {
  return array ('create xml content','edit own xml content');
}
/**
* Implementation of hook_access().
*/  
function xmlparser_access($op, $node, $account) {
  if ($op == 'create') {
    // Only users with permission to do so may create this node type.
    return user_access('create xml contene', $account);
  }
  if ($op == 'update' || $op == 'delete') {
  if (user_access('edit own xml content', $account) &amp;&amp; ($account-&gt;uid == $node-&gt;uid)) {return TRUE;}
  }
}  
/**
* Implementation of hook_form().
*/
function xmlparser_form (&amp;$node, $form_state) {
  $type = node_get_types('type', $node);

  $form['title'] = array(
    '#type' =&gt; 'textfield',
'#title' =&gt; check_plain($type-&gt;title_label),
'#required' =&gt; TRUE,
'#default_value' =&gt; $node-&gt;title,
'#weight' =&gt; -5
  );
  $form['xml'] = array(
    '#type' =&gt; 'textarea',
'#title' =&gt; check_plain('xml'),
'#required' =&gt; TRUE,
'#weight' =&gt; -5
  );
  $form['xslt'] = array(
    '#type' =&gt; 'textarea',
'#title' =&gt; check_plain('xslt'),
'#required' =&gt; TRUE,
'#weight' =&gt; -5
  );        
  $form['body_filter']['body'] = array(
    '#type' =&gt; 'textarea',
'#title' =&gt; check_plain($type-&gt;body_label),
'#default_value' =&gt; $node-&gt;body,
'#required' =&gt; FALSE
  );
  $form['body_filter']['filter'] = filter_form($node-&gt;format);
    return $form;
}


So this brought me to the point that my content type comes up when creating new content - cool. But where do I need to go now to actually save my values? Where would I save my HTML once the XML is parsed on submit?

I know quite a few question, but any input would be great appreciated!

Thanks,
 Uwe
Here is an idea that will keep coding to a minimum using already existing modules:


Using CCK if D6 or the fields if D7 create a regular content type and add an extra field for the XML as I will use the automatically added body to store the XSLT. On the content type display section hide the XSLT field, this way the data is collected, but it is not shown when the node is been view.
I will install the custom formatter module to create a text formatter where I can apply the XSLT to the XML and then present it as HTML.
If I can not apply the formatter directly to the body field in the content type display settings I will the hide both fields (body &amp; XSLT) and using views attachment in D6 or EVA in D7 attach the body field with the formatter applied to the content type.
Last but not least if I plan to re-use this setup in others sites I will use the "Features" module to exported.