[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Retrieving urls when using document()
I'm trying to create a nice table of contents from multiple XML
files. Cruising through the FAQ, I ran across the idea of using
filelist.xml <documents> <doc href="105_imp.xml"/> <doc href="110_vc.xml"/> <doc href="115_his.xml"/> </documents> table_of_contents.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="iso-8859-1"/> <xsl:variable name="documents" select="document(/documents/doc/@href)"/> <xsl:template match="/"> <xsl:for-each select="$documents"> <xsl:apply-templates /> </xsl:for-each> </xsl:template> <xsl:template match="Title|Table/Title"> <p> <a> <xsl:attribute name="href"><xsl:value-of select="substring-before(name($documents),'.xml')"/>.html#<xsl:value-of select="."/></xsl:attribute> <xsl:value-of select="."/> </a> </p> </xsl:template> </xsl:stylesheet> Current output fragment <p><a href=".html#About">About</a></p> <p><a href=".html#Message">Message</a></p> So this is really close to doing what I hope for but I'd like to find out if it is possible to get <xsl:value-of select="substring-before($documents,'.xml')"/> to reliably give me the href of the document that I'm processing in the for-each loop. Doesn't look like it should be difficult but it is stumping me. Lynn
'I think an "uncatched exception" deserves three bug reports: one for the exception, one for not catching it, and one for abuse of the English language.' Michael Kay
|
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
|