Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning Element Value to a Variable

Status
Not open for further replies.

andyros

Programmer
Jul 12, 2005
42
GB
hey guys

Is there anyway i can assign the value of an element to a varible in an incremental manner?

I have this xml for example

Code:
<example>
   <definition>Business</definition>
   <definition>Sport</definition>
</example>

now these values are dynamic, so there may be more than one deifinition. What id like to do is create a varible for each definition, is this possible?

I've tired...
Code:
<xsl:for-each select="/example/definition">

   <xsl:variable name="position()" select="/example/definition[position()]"/>

</xsl:for-each>

and also

Code:
<xsl:for-each select="/example/definition">

<xsl:variable name="i" select="/example/definition/position()"/>

<xsl:variable name="temp" select=$i>

****doing what i want with this definition...****

</xsl:for-each>

Is this possible, i've got everything else how i want it, but if this is not possible then its back to the drawing board :(!

thanks
andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top