xsl-list
[Top] [All Lists]

[xsl] Problem using variables with xpath -- simplified query

2007-04-05 14:24:41
I am running into problem using a Variable inside a
XPath. I've placed my query as comments in the
following XSL 

<?xml version='1.0' ?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'>
<xsl:output method='xml'/>

<!-- loading external file -->
<xsl:variable name="doc2node"
select="document('/prod/appl/Docs/metadata.xml')" />

<!-- var declaration for ' -->
<xsl:variable name="apos" select='"&apos;"' />

<!-- The input XML has only one node with attr url="y"
-->
<xsl:variable name="pdfdoctitle"
select="//somenodename/@url" />

<xsl:template match="/">
  <TITLE>
   <!-- The following block works in IDE like Stylus
studio or XMLSpy but not using a simple Java Transform
code -->
   <xsl:value-of
select="$doc2node/documents/doc[(_at_)id=$pdfdoctitle]/@title"/>

   <!-- The following static compare works -->
   <!--xsl:value-of
select="$doc2node/documents/doc[(_at_)id='y']/@title"/-->
  </TITLE>
</xsl:template>
</xsl:stylesheet>

Thanks,
-Raghav


 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--