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

Retrieving urls when using document()

Subject: Retrieving urls when using document()
From: Lynn Alford <lynn.alford@xxxxxxxxxx>
Date: Thu, 17 Nov 2005 10:55:27 +1000
using href in loop
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


Lynn Alford Tel (07) 47 81 6256 ITR Email: imla@xxxxxxxxxx JCU QLD 4811 Australia ICQ: 64096907 MSN: nicarra60@xxxxxxxxxxx Y!: nicarra60

'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

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.