p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   Doxgyen xml output -> DITA concepts, is xslt the way to go? (http://p2p.wrox.com/showthread.php?t=83605)

akevan May 10th, 2011 01:34 PM

Doxgyen xml output -> DITA concepts, is xslt the way to go?
 
Hi all, I'm very new to xslt and wondering if it's the right solution for me. I know I could write this transformation with python, but figured xslt might be the more standard way of doing this.

I've got source code documentation output from Doxygen in XML format. There are hundreds of .xml files, each with details about a specific function, struct, group, etc.

There is one main index.xml though, which will serve as my starting point, and references these other .xml files mentioned above.

I'll just give an example of what I need to do...

I need to parse index.xml, find an element like:

Code:

<compound refid="d9/d6e/structml_s_example" kind="struct"><name>mlSExample</name>
    <member refid="d9/d6e/structml_s_example_1a8a9d0f29730dbd67c2c7099fd3659d29" kind="variable"><name>mInputBuffer</name></member>
    <member refid="d9/d6e/structml_s_example_1af91f8e225e2a8a0face5fb01f72056d0" kind="variable"><name>mFFTOutput</name></member>
  </compound>


And transform it into something like this:

Code:

<concept id="id_struct_mlSExample">
 <title>mlSExample</title>
 <conbody>
  <codeblock id="id_codeblock_mlSExample">
    struct mlSExample
    {
        mlFix*      mInputBuffer;             
        <xref href="../struct/ref_struct_mlFFT" format="dita">mlSFFT</xref>* mFFTOutput;           
    };
  </codeblock>
  <p><b>Description:</b></p>
  <p id="id_desc_mlSExample">This structure defines the main Example object. Main example objects are used to initialize
    core tasks and contain one or more <xref href="../struct/ref_struct_mlSStage.xml" format="dita"><codeph>mlSStage</codeph></xref> objects.
    They are initialized using <xref href="../functions/ref_function_mlExampleInit.xml" format="dita"><codeph>mlExampleInit</codeph></xref> and
    example stages are assigned to the example object.
  using <xref href="../functions/ref_function_mlExampleAdd.xml" format="dita"
    ><codeph>mlExampleAdd</codeph></xref>.</p>
  <p><b>Members:</b></p>
  <table frame="all" colsep="1" rowsep="1" id="table_wpl_wir_fc">
  <tgroup cols="2" colsep="1" rowsep="1" outputclass="FormatA">
    <colspec colnum="1" colname="1" colwidth="1.0*"/>
    <colspec colnum="2" colname="2" colwidth="4.92*"/>
    <thead>
    <row rowsep="1">
      <entry colname="1">Member</entry>
      <entry colname="2">Description</entry>
    </row>
    </thead>
    <tbody>
    <row rowsep="1">
      <entry colname="1"><codeph>mInputBuffer</codeph></entry>
      <entry colname="2">The input buffer description</entry>
    </row>
    <row rowsep="1">
      <entry colname="1"><codeph>mFFTOutput</codeph></entry>
      <entry colname="2">Pointer to a FFT object. Can be NULL if no FFT output is needed.</entry>
    </row>
    </tbody>
  </tgroup>
  </table>
 </conbody>
 </concept>

All the extra information (descriptions, etc.) in the transformed output comes from the referenced xml file in a subdirectory (refid="d9/d6e/structml_s_example").

So I need the ability to:
- open referenced .xml files and extract information from them
- reference other .xml files in my output
- write multiple .xml files, one each for each instance of the <compound>
element in index.xml
- a whole bunch of other stuff!

Does this look like an .xslt nightmare, or something that wouldn't be too bad?

Thanks for any input -

A

mhkay May 10th, 2011 07:19 PM

It all sounds very straightforward to do in XSLT, though I can't immediately see where all the information in your output document comes from (and I can't tell what strings in your index document might be references to other files... - don't believe the people who tell you that because it's XML, the meaning is self-explanatory.)


All times are GMT -4. The time now is 07:54 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.