View Single Post
  #1 (permalink)  
Old February 21st, 2011, 04:18 PM
chilly chilly is offline
Authorized User
Points: 310, Level: 6
Points: 310, Level: 6 Points: 310, Level: 6 Points: 310, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating Dynamic Elements with Values from Other Element values

I am looking for generic template where it uses an element value into a tag and another element value as a field value.

here is source

Code:
<attributeList count="71">
<attribute>
<name>name1</name>
<string>Value1</string>
</attribute>
<attribute>
<name>name2</name>
<integer>value2</integer>
</attribute>
<attribute>
<name>name3</name>
<boolean>value3</boolean>
</attribute>
<attribute>
<name>name4</name>
<unknown>value4</unknown>
</attribute>
<attribute>
<name>name5</name>
<datetime>value5</datetime>
</attribute>
</attributeList>
output

Code:
<name1>value1<name1>
<name2>value2<name2>
<name3>value3<name3>
<name4>value4<name4>
<name5>value5<name5>

Does this code works? please advice, I have some bugs and testing around at this time
Code:
<xsl:element name="{../attributeList/attribute/name}">
	<xsl:value-of select="../attributeList/attribute/string | ../attribute/integer | ../attribute/boolean | ../attribute/unknown | ../attribute/datetime"/>
	</xsl:element>
Reply With Quote