RE: [xsl] Processing on both a document list and referenced documents

Subject: RE: [xsl] Processing on both a document list and referenced documents
From: "Bjorndahl, Brad" <brad.bjorndahl@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Mar 2008 08:53:33 -0400
Mark,

I'm glad this works for you. I have a few comments if you don't mind.

I used the term 'regression' incorrectly in my previous replies. I should have
used 'recursion'.

You can put your namespace declaration for 'hdlg' on the stylesheet element
only.

I still think you should generalize your template to handle any number of
levels of directories (using recursion).

Brad


-----Original Message-----
From: Mark Peters [mailto:flickrmeister@xxxxxxxxx]
Sent: March 12, 2008 8:04 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Processing on both a document list and referenced
documents

Hi Brad, everyone.

Here's what worked for me:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
        <xsl:output method="html" indent="yes"/>
        <xsl:template match="hdlg:filesystem"
xmlns:hdlg="http://www.hdlg.info/XML/filesystem";>
                <html>
                        <body>
                                <ul>
                                        <xsl:for-each select="hdlg:folder"
xmlns:hdlg="http://www.hdlg.info/XML/filesystem";>
                                                <li>
                                                        <xsl:value-of
select="@url"/>
                                                        <ul>
                                                                <xsl:for-each
select="document(hdlg:file/@url)"
xmlns:hdlg="http://www.hdlg.info/XML/filesystem";>
                                                                        <ul>
                                                                             
   <xsl:for-each select="topic">
                                                                             
           <li>
                                                                             
                   <xsl:value-of select="title"/>
                                                                             
                   <ul>
                                                                             
                           <xsl:for-each select="topic">
                                                                             
                                   <li>
                                                                             
                                           <xsl:value-of select="title"/>
                                                                             
                                           <ul>
                                                                             
                                                   <xsl:for-each
select="topic">
                                                                             
                                                           <li>
                                                                             
                                                                   <xsl:value
-of select="title"/>
                                                                             
                                                           </li>
                                                                             
                                                   </xsl:for-each>
                                                                             
                                           </ul>
                                                                             
                                   </li>
                                                                             
                           </xsl:for-each>
                                                                             
                   </ul>
                                                                             
           </li>
                                                                             
   </xsl:for-each>
                                                                        </ul>
                                                                </xsl:for-eac
h>
                                                        </ul>
                                                </li>
                                        </xsl:for-each>
                                </ul>
                        </body>
                </html>
        </xsl:template>
</xsl:stylesheet>

Current Thread