By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,934 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

Obtaining variable information from an XML file using xslt.

P: 2
Hello,

This question is regarding applying an XSL transformation to map one XML file to another. Im posting this question again.

Say I have original XML attributes like:
<series>
<number>1</number>
<series>

and the final XML output file as:
<series number="1"/>

I'm trying to use
<xsl:variable name="number" select="series/number/>

to get this variable and
<series number=<xsl:value-of select="$number" />
to display this value in the output xml file.

However it seems like the xsl variable is not "extracted" correctly from the original file.

Please advise why.

best regards,
Cartik
May 2 '07 #1
Share this Question
Share on Google+
1 Reply


dorinbogdan
Expert 100+
P: 839
<xsl:variable name="number" select="series/number/>

to get this variable and
<series number=<xsl:value-of select="$number" />
Welcome to TheScripts TSDN....

Try to use other avriable name instead of "number" , it is a reserved xsl function.
Also, it's not recommended as to use it a node name.

Try something like this:
XML:
Expand|Select|Wrap|Line Numbers
  1. <series><num>1</num></series>
XSL:
Expand|Select|Wrap|Line Numbers
  1. <xsl:variable name="varname" select="series/num[0]"> 
  2. <series num="{$number}" /> 
May 3 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.