|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to retrieve value in xsl:value variable??
I'm new to XSL, and thought someone on the Net can give me some help on
this.
I have the following elements in my x.xml file. Some of the information
in the file will be extracted and used
in a text doc:
<PERIODIC_TABLE>
<ATOM STATE="GAS">
<NAME>Hydrogen</NAME>
<SYMBOL>H</SYMBOL>
</ATOM>
</PERIODIC_TABLE>
----------------------------------------------------------------------------------------------
Desired output: Information for: Hydrogen
----------------------------------------------------------------------------------------------
So I defined the following in my x.xsl file:
<xsl:template match="/"><xsl:apply-templates/></xsl:template>
<xsl:template match="ATOM">
<!-- define a varialbe -->
<xsl:variable name='atomname'>
<xsl:value-of select="NAME"/>
</xsl:variable>
<!-- print out some information -->
Information for: <xsl:value-of select='$atomname'/>
Name: <xsl:value-of select='$atomname'/>
<!-- end of output -->
</xsl:template>
</xsl:stylesheet>
-----------------------------------------------------
The reson I defined a variable "atomname" is because I want to use it in
several places in my doc. However,
I would like to be able to retrieve the value using $atomname without
invoking <xsl:value> call, i.e. is
there a way that I can print my information in the following way in my
x.xsl file?
<!-- print out some information -->
Information for: '$atomname'
Name: '$atomname'
<!-- end of output -->
This didn't work ($atomname is printed instead of the value stored in
the variable) when I tried to using to process my
files using a XSLT processor.
Thanks for any help/suggestion, etc. If possible, email reply preferred.
Lucie C. Chan <lcchan@xxxxxxxxxx>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








