Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


How to resolve a XPath in XSLT

From: John Henckel <john.NoSP@-.--------.--->
To: NULL
Date: 2/2/2006 11:49:00 AM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent