|
Subject: How to retrieve value in xsl:value variable?? From: "Lucie C. Chan" <lcchan@xxxxxxxxxx> Date: Sat, 19 Feb 2000 16:19:03 -0500 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: variables and substring, Kay Michael | Thread | Re: How to retrieve value in xsl:va, Steve Tinney |
| Re: How powerful is this XSLT?, Tagore Smith | Date | Re: variables and substring, David Carlisle |
| Month |