Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2011, 01:34 PM
Registered User
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old May 10th, 2011, 07:19 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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.)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<?javax.xml.transform.disable-output-escaping ?> robbert XSLT 5 January 5th, 2011 07:28 PM
XML > XSLT and ASP.NET 2.0 bonekrusher XSLT 7 September 22nd, 2006 06:26 PM
How to force XSLT to output a close tag in XML? richcon XSLT 2 June 29th, 2006 02:39 AM
Forms with XML > XSLT > XHTML kwilliams XSLT 0 October 27th, 2005 09:52 AM
2 XML Docs > 1 XSLT Stylesheet kwilliams XSLT 3 September 12th, 2005 11:22 AM



All times are GMT -4. The time now is 09:11 AM.


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