Re: [xsl] Manipulating values from an xml file using xsl key

Subject: Re: [xsl] Manipulating values from an xml file using xsl key
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 7 Sep 2006 17:07:04 +0100
> When I run this in the browser,

a browser is a fairly hostile environment for debugging a stylesheet,
they are pretty much designed not to bother the users with scary things
like error messages, It's usually a good idea to debug first using a
command line or IDE based system.

Also note that depending on wher eyour main file is, there may be
browser security issues that prevent document(..) from loading external
resources.

> What I am trying to achieve is to iterate over the filename and list
> them in the browser.
It would seem that you don't want to use keys for that, just


    <xsl:for-each select="document('xmlFile.xml')/file/fileId">
	          <a class="hyperlink"
	          href="javascript:selectXml('{@filename}','{@filepath}');">ccc</a>
</xsl:for-each>

>  So where am I going wrong?
	       <xsl:for-each select="document('xmlFile.xml')">
document() just selects 1 node (/) so this for-each just iterates once,
with . being the whole document.

	          <xsl:variable name="vXmlName"     select="key('fileIndex',.)"/>
. there is taken to be the string value of the current node which is all
the character data in the docuemnt (which is just the white space used
for indentation, as all the real data is in attriubutes)

David

Current Thread