frenchxmlnewbie
Technical User
Hello
I would like to make the following transformation using xslt:
Source:
<code>
<ap:Topic DOId="DptmmZv5qkeUEAjLtRkqVA==">
<ap:Text PlainText="Texte du topic">
<ap:Font Bold="yes"/>
</ap:Text>
</ap:Topic>
Result:
<code>
<node ID="DptmmZv5qkeUEAjLtRkqVA" TEXT="Texte du topic">
<font BOLD="true"/>
</node>
</code>
I use the following xslt source:
<code>
<xsl:template match="ap:Topic">
<node>
<xsl:attribute name="TEXT">
<xsl:value-of select="./ap:Text/@PlainText" />
</xsl:attribute>
<xsl:apply-templates select="./ap:Text" />
</node>
</xsl:template>
<xsl:template match="ap:Text">
<xsl:apply-templates select="./ap:Font" />
</xsl:template>
<xsl:template match="ap:Font">
<xsl:element name="font">
<xsl:attribute name="BOLD">
<xsl:value-of select="@Bold"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</code>
Problem is: the template ap:Text erase all the content of attribute TEXT, as if I could not parse element "Text" twice.
Please help.
I would like to make the following transformation using xslt:
Source:
<code>
<ap:Topic DOId="DptmmZv5qkeUEAjLtRkqVA==">
<ap:Text PlainText="Texte du topic">
<ap:Font Bold="yes"/>
</ap:Text>
</ap:Topic>
Result:
<code>
<node ID="DptmmZv5qkeUEAjLtRkqVA" TEXT="Texte du topic">
<font BOLD="true"/>
</node>
</code>
I use the following xslt source:
<code>
<xsl:template match="ap:Topic">
<node>
<xsl:attribute name="TEXT">
<xsl:value-of select="./ap:Text/@PlainText" />
</xsl:attribute>
<xsl:apply-templates select="./ap:Text" />
</node>
</xsl:template>
<xsl:template match="ap:Text">
<xsl:apply-templates select="./ap:Font" />
</xsl:template>
<xsl:template match="ap:Font">
<xsl:element name="font">
<xsl:attribute name="BOLD">
<xsl:value-of select="@Bold"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</code>
Problem is: the template ap:Text erase all the content of attribute TEXT, as if I could not parse element "Text" twice.
Please help.