[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Multiple recursive transforms using document funct
You are having a problem because you are asking the processor to find tags in the dictionary document while it has loaded the template document. Of course, it can't find them. I'm unclear what you are trying to accomplish here. Do you want to get the second row from the dictionary where the template says 'row 2'? If that's it, you could do it something like this (not tested, but it should be close enough for you to work with). The idea is to match against the position of the row, so that the 2nd row in the template would give you the second child element in the dictionary ( you may need to add one to the position). <!-- new template file--> <rows> <row>1</row> <row>2</row> </rows> <!-- Fragments of style sheet --> <xsl:variable name='rows' select='document(template.xml)'/> <xsl:variable name='dict' select='document(dictionary.xml)'/> <xsl:template match='/'> <xsl:for-each select='$rows/row'> <xsl:value-of select='$dict/*[position()=.]'/> </xsl:for-each> </xsl:template> Cheers, Tom P [Rowell Sotto] > I'm having some semantic problems with how the > document function works in conjunction with the > xsl:apply-templates tag. I have two files: > template.xml and dictionary.xml that I load using an > xsl stylesheet(load.xsl) transformed against files.xml > using the document function like so: > > <!-- command line --> > java com.icl.saxon.StyleSheet files.xml load.xsl > > <!-- files.xml --> > <files> > <file>template.xml</file> > <file>dictionary.xml</file> > </files> > > <!-- load.xsl --> > ... > <xsl:template match="file"> > <xsl:apply-templates select="document(.)"/> > </xsl:template> > > <xsl:template match="row1"> > <div><xsl:value-of select="row1"/></div> > <span><xsl:value-of select="//name"/></span> > </xsl:template> > > <xsl:template match="row2"> > <div><xsl:value-of select="row2"/></div> > <span><xsl:value-of select="//vendor"/></span> > </xsl:template> > ... XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|