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

RE: Recursively merge (aggregate) and traverse DOM tre

Subject: RE: Recursively merge (aggregate) and traverse DOM trees (XML files)?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 20 Jun 2006 08:15:44 +0100
traverse dom
Your stylesheet needs to include within it an instruction such as

<xsl:apply-templates select="document(@url)"/>

to dereference the links and recursively process the referenced document.

I don't know what this is supposed to be:

<?xml versionfiltered="1.0" encoding="UTF-8"?>

but it isn't XML.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Laky Tang [mailto:tulaky@xxxxxxxxx] 
> Sent: 20 June 2006 03:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Recursively merge (aggregate) and traverse DOM 
> trees (XML files)?
> 
> I am trying to recursively merge a tree of XML files and then 
> apply some templates to it. I googled and also searched this 
> mailing list but did not find any help. I hope this is 
> possible using XSLT. Can somebody please point me in the 
> right direction?
>  
> Here is a sample of the input files and desired output. I 
> tried a sample.xsl (see below)which only goes thru the root 
> file, but need help in making it recursively go thru all the 
> linked files as well.
>  
> Thanks in advance,
> Laky, Tang
> -----------------
> sample1.xml :
> <?xml versionfiltered="1.0" encoding="UTF-8"?> 
> <?xml-stylesheet type="text/xsl" href="sample.xsl"?> <a> <b p 
> ="key1" q="2"> xxx </b> <b url = "sample2.xml"></b> <b p 
> ="key10" q ="27">yyyy</b> </a>
>  
> sample2.xml :
> <?xml versionfiltered="1.0" encoding="UTF-8"?> <a> <b p 
> ="key4" q="22"> xxx2 </b> <b url = "sample3.xml"></b> <b p 
> ="key7" q ="37">yyyy2</b> <b url = "sample4.xml"></b> </a>
>  
> sample3.xml :
> <?xml versionfiltered="1.0" encoding="UTF-8"?> <a> <b p 
> ="key5" q="23"> xxx3 </b> <b p ="key6" q ="26">yyyy3</b> </a>
>  
> sample4.xml :
> <?xml versionfiltered="1.0" encoding="UTF-8"?> <a> <b p 
> ="key8" q="24"> xxx4 </b> <b p ="key9" q ="25">yyyy4</b> </a>
>  
> sample.xsl :
> <?xml versionfiltered="1.0" encoding="UTF-8"?> 
> <xsl:stylesheet versionfiltered="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
> xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
> xmlns:xlink="http://www.w3.org/1999/xlink">
> <xsl:template match="/">
> <html>
> <head>
> <title>Sample</title>
> </head>
> <h1>
> <center>
> </center>
> </h1>
> <p/>
> <xsl:for-each xml:space="default" select="param"> 
> <xsl:value-of select="."/> </xsl:for-each> <table border="2" 
> bgcolor="yellow"> <tr> <th>P</th> <th>Q</th> <th>text</th> 
> </tr> <xsl:for-each select="//b"> <tr> <td> <xsl:value-of 
> select="@p"/> </td> <td> <xsl:value-of select="@q"/> </td> 
> <td> <xsl:value-of select="."/> </td> </tr> </xsl:for-each> 
> </table> </html> </xsl:template> </xsl:stylesheet>
> 
>  
> Desired output (preferably as a html table):
>  
> P    Q    text
> key1    2    xxx 
> key4    22    Xxx2
> key5    23    xxx3
> key6    26    yyy3
> Key7    37    yyy2
> key8    24    xxx4
> key9    25    yyy4
> key10    27    yyyy
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 

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.