Transformacja pary wartości XSL
Nie jestem pewien, czy jest to możliwe, ale tutaj idzie.
Z tego XML:
<?xml version="1.0" encoding="UTF-8"?>
<AttributesCollection>
<Attributes>
<AttributeName>AAA</AttributeName>
<AttributeValue>Value1</AttributeValue>
</Attributes>
<Attributes>
<AttributeName>BBB</AttributeName>
<AttributeValue>Value2</AttributeValue>
</Attributes>
</AttributesCollection>
Chcę przekonwertować go na następujący przy użyciu transformacji XSL:
<Attributes>
<AAA>Value1</AAA>
<BBB>Value2</BBB>
</Attributes>
Mogę uzyskać nazwy atrybutów, ale nie wiem, jak utworzyć XML. Oto co próbowałem.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="./AttributesCollection/Attributes/AttributeName">
Name:<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Co daje mi:
<?xml version="1.0" encoding="UTF-8"?>
Name:AAA
Name:BBB
Czy więc można robić to, czego szukam? Jakaś pomoc? Dzięki