11 |
|
|
12 |
<xsl:template match="choice"> |
<xsl:template match="choice"> |
13 |
<choice> |
<choice> |
14 |
<!-- iterate over all attributes --> |
<!-- copy all attributes except 'value' and 'options' --> |
15 |
<xsl:for-each select="@*"> |
<xsl:copy-of select="@*[local-name() != 'value' and local-name() != 'options']"/> |
16 |
<xsl:choose> |
<!-- generate 'value' attribute with value of 'options' --> |
17 |
<xsl:when test="name() = 'value' and current() = ''"/> |
<xsl:attribute name="value"> |
18 |
<!-- ignore old value attribute --> |
<xsl:value-of select="@options"/> |
19 |
<xsl:when test="name() = 'options'"> |
</xsl:attribute> |
|
<!-- save old options attribute as value --> |
|
|
<xsl:attribute name="value"> |
|
|
<xsl:value-of select="."/> |
|
|
</xsl:attribute> |
|
|
</xsl:when> |
|
|
<xsl:otherwise> |
|
|
<!-- copy thru all other attributes --> |
|
|
<xsl:attribute name="{name()}"> |
|
|
<xsl:value-of select="."/> |
|
|
</xsl:attribute> |
|
|
</xsl:otherwise> |
|
|
</xsl:choose> |
|
|
</xsl:for-each> |
|
20 |
</choice> |
</choice> |
21 |
</xsl:template> |
</xsl:template> |
22 |
|
|