John Henckel
Usenet Archive
- Joined
- May 21, 2004
- Messages
- 2
- Reaction score
- 0
I have a data file like this.....
<top>
<graph>
<part>
<param name="mass">1 </param>
</part>
<body name="nut">
<link href="#/top/graph['1']/part['1']"/>
</body>
</graph>
</top>
Notice the "link" is a path to another node in the file. I want to use XSLT to process this file to print a table with the name of each body and it's mass. But I cannot figure out how to do it. This is what I tried......
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="top//body">
<p/> <xsl:value-of select="@name"/> has mass
<xsl:variable name="var" select="substring(link/@href,2)"/> <xsl:value-of select="$var/param"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
But this doesn't work because it says $var/param is a syntax error. Any ideas? Am I trying to do the impossible? I do not have any control of the input data representation.
TIA, john
<top>
<graph>
<part>
<param name="mass">1 </param>
</part>
<body name="nut">
<link href="#/top/graph['1']/part['1']"/>
</body>
</graph>
</top>
Notice the "link" is a path to another node in the file. I want to use XSLT to process this file to print a table with the name of each body and it's mass. But I cannot figure out how to do it. This is what I tried......
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="top//body">
<p/> <xsl:value-of select="@name"/> has mass
<xsl:variable name="var" select="substring(link/@href,2)"/> <xsl:value-of select="$var/param"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
But this doesn't work because it says $var/param is a syntax error. Any ideas? Am I trying to do the impossible? I do not have any control of the input data representation.
TIA, john