xsl-list
[Top] [All Lists]

[xsl] Help with creating Task child of Task

2008-12-31 14:01:28
I'm creating an XML to XML transform. Transforming a kluged DITA model into standard DITA. I have to transform something called <reference-content> into a <task> child of the root task.

I can easily transform <reference-content> to <task>. Where I'm stuck is making the new task a sibling of the currently containing <taskbody>. Currently <reference-content> is a child of <taskbody>. Once <reference-content> is tranformed to <task>, I need to close the containing <taskbody> and make the new <task> a sibling of that <taskbody>.

My XML source:

<?xml version="1.0" encoding="UTF-8"?>
<task xml:lang="en-us" xsi:noNamespaceSchemaLocation="../../../../catalog/task.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <title>TITLE</title>
   <shortdesc>SHORT DESCRIPTION</shortdesc>
   <taskbody>
       <prereq>
               <ul>
                   <li>
                       <p>Paragraph</p>
                   </li>
               </ul>
       </prereq>
<steps>
<step>
<cmd>Click <uicontrol>Apply</uicontrol>.</cmd>
</step>
</steps>
<result>
   <p>You have successfully completed this procedure.</p>
</result>
<reference-content>
<table border="1" cellpadding="2" cellspacing="0" framewidth="wide" id="table1">
       <caption number="yes">TABLE TITLE</caption>
       <tbody>
           <tr>
               <td align="left" valign="top" width="20%">
               </td>
               <td align="left" valign="top" width="25%"></td>
               <td align="left" valign="top" width="30%"></td>
               <td align="left" valign="top" width="25%"></td>
           </tr>
           <tr>
               <td align="left" valign="top" width="20%"></td>
               <td align="left" valign="top" width="25%"></td>
               <td align="left" valign="top" width="30%"></td>
               <td align="left" valign="top" width="25%"></td>
           </tr>
</tbody>
</table>
</reference-content>
</taskbody>
</task>

Current result:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE task   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="MyID01" class="-topic/topic task/task " xml:lang="en-us">
   <title>TITLE</title>
   <shortdesc>SHORT DESCRIPTION</shortdesc>
   <taskbody>
       <prereq>
               <ul>
                   <li>
                       <p>Paragraph</p>
                   </li>
               </ul>
       </prereq>
<steps>
<step>
<cmd>Click <uicontrol>Apply</uicontrol>.</cmd>
</step>
</steps>
<result>
   <p>You have successfully completed this procedure.</p>
</result>
<task><title/><taskbody><context>
   <table id="table1" pgwide="1"><tgroup cols="4">
       <title>TABLE TITLE</title>
       <tbody>
           <row>
               <entry align="left">
               </entry>
               <entry align="left"/>
               <entry align="left"/>
               <entry align="left"/>
           </row>
           <row>
               <entry align="left"/>
               <entry align="left"/>
               <entry align="left"/>
               <entry align="left"/>
           </row>
</tbody>
</tgroup></table>
</context></taskbody></task>
</taskbody>
</task>

DESIRED RESULT:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE task   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="MyID01" class="-topic/topic task/task " xml:lang="en-us">
   <title>TITLE</title>
   <shortdesc>SHORT DESCRIPTION</shortdesc>
   <taskbody>
       <prereq>
               <ul>
                   <li>
                       <p>Paragraph</p>
                   </li>
               </ul>
       </prereq>
<steps>
<step>
<cmd>Click <uicontrol>Apply</uicontrol>.</cmd>
</step>
</steps>
<result>
   <p>You have successfully completed this procedure.</p>
</result></taskbody>
<task><title/><taskbody><context>
   <table id="table1" pgwide="1"><tgroup cols="4">
       <title>TABLE TITLE</title>
       <tbody>
           <row>
               <entry align="left">
               </entry>
               <entry align="left"/>
               <entry align="left"/>
               <entry align="left"/>
           </row>
           <row>
               <entry align="left"/>
               <entry align="left"/>
               <entry align="left"/>
               <entry align="left"/>
           </row>
</tbody>
</tgroup></table>
</context>
</taskbody></task>
</task>


--

*Charles Flanders*

Senior Content Analyst

Vasont Content Management Solutions

717.764.9720 x302

cflanders(_at_)vasont(_dot_)com <mailto:cflanders(_at_)vasont(_dot_)com>



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>