[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Creating nested structures

Subject: Re: Creating nested structures
From: scott gabelhart <swgabel@xxxxxxxxxxxx>
Date: Fri, 23 Jan 2004 08:41:01 -0500
nested xml file
Jarno.Elovirta@xxxxxxxxx wrote:

Hi,



I am stuck trying to determine how to create nested structures from my
transform for my xsl output.

Desired output example would be
<table><tr><td></td></tr><table><tr><td></td></tr></table></table>

Also is there a XPath method that can be employed to find a begining elements closing tag structure when transforming a nested xml input file?



XPath doesn't operate on tags, but rather on node tree.




Example:

Input xml file:

<TABLE><DPROW><OBJECT>2</OBJECT><OBJECT>4</OBJECT></DPROW><TAB
LE><DPROW><OBJECT>4</OBJECT></DRROW></TABLE></TABLE>



This transformation is so simple that I can only suggest that you take some time to learn XPath and XSLT—if you have problems after that, show use the source XML, the stylesheet so far, and the desired output.


Cheers,

Jarno - Feindflug: Glaubenskrieg

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Jarno,

thanks for your comments. I know XSLT quite well; but I am not very strong with XPath. Any additional insight to solving my problem would be greatly appreciated.

XML Input file to be parsed: <snippet>

<FORMATTED>
<title>Report1</title>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" OCCURENCE="1">
<DPROW>
<OBJECT ALIGN="left" STYLE="background-color:#FFFFFF;" HEIGHT="10"/>
</DPROW>
</TABLE>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="842" OCCURENCE="2">
<DPROW>
<OBJECT ALIGN="left" WIDTH="3"/>
<OBJECT>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" OCCURENCE="2">
<DPROW>
<OBJECT WIDTH="4" HEIGHT="6"/>
<OBJECT WIDTH="22" HEIGHT="6"/>
<OBJECT WIDTH="67" HEIGHT="6"/>
<OBJECT WIDTH="2" HEIGHT="6"/>
<OBJECT WIDTH="211" HEIGHT="6"/>
<OBJECT WIDTH="2" HEIGHT="6"/>
<OBJECT WIDTH="273" HEIGHT="6"/>
<OBJECT WIDTH="48" HEIGHT="6"/>
<OBJECT WIDTH="92" HEIGHT="6"/>
<OBJECT WIDTH="2" HEIGHT="6"/>
<OBJECT WIDTH="2" HEIGHT="6"/>
<OBJECT WIDTH="82" HEIGHT="6"/>
<OBJECT WIDTH="6" HEIGHT="6"/>
<OBJECT WIDTH="22" HEIGHT="6"/>
<OBJECT WIDTH="5" HEIGHT="6"/>
</DPROW>
<DPROW>
<OBJECT WIDTH="4"/>
<OBJECT WIDTH="22"/>
<OBJECT WIDTH="67" VALIGN="TOP">
<TABLE BORDER="0" WIDTH="66" OCCURENCE="2">
<DPROW>
<OBJECT STYLE="color:#000000;font-family:Arial;font-size:10pt;background-color:#FFFFFF;height:20px;font-weight:bold;">Agent ID:</OBJECT>
</DPROW>
</TABLE>
</OBJECT>
<OBJECT WIDTH="2" COLSPAN="2" VALIGN="TOP">
<TABLE BORDER="0" WIDTH="212" OCCURENCE="2">
<DPROW>
<OBJECT STYLE="color:#000000;font-family:Arial;font-size:12pt;background-color:#FFFFFF;height:20px;font-weight:bold;">100008</OBJECT>
</DPROW>
</TABLE>
</OBJECT>
<OBJECT WIDTH="2"/>
<OBJECT WIDTH="273"/>
<OBJECT WIDTH="48"/>
<OBJECT WIDTH="92"/>
<OBJECT WIDTH="2"/>
<OBJECT WIDTH="2" COLSPAN="2" VALIGN="TOP">
<TABLE BORDER="0" WIDTH="84" OCCURENCE="2">
<DPROW>
<OBJECT STYLE="color:#000000;font-family:Arial;font-size:10pt;background-color:#FFFFFF;height:20px;font-weight:bold;">12/19/2003</OBJECT>
</DPROW>
</TABLE>
</OBJECT>
<OBJECT WIDTH="6"/>
<OBJECT WIDTH="22"/>
<OBJECT WIDTH="5"/>
<OBJECT HEIGHT="20"/>
</DPROW>
<DPROW>
<OBJECT WIDTH="4"/>
<OBJECT WIDTH="22" COLSPAN="3" ROWSPAN="2" VALIGN="TOP">
<TABLE BORDER="0" WIDTH="90" OCCURENCE="2">
<DPROW>
<OBJECT STYLE="color:#000000;font-family:Arial;font-size:10pt;background-color:#FFFFFF;height:20px;font-weight:bold;">Agent Name:</OBJECT>
</DPROW>
</TABLE>
</OBJECT>


Desired output is xhtml<-creating xhtml output I have no problem with. The problem I am stuck on is given the above nested input file I need to know when to transform the closing </TABLE> element to </table> in my transformed output. Once I have completed that task I need to be able to use the same logic for the DPROW and OBJECT structure.

- Scott


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.