Question

I'm new to XSLT, can someone give me a hand with this?

When in the source xml exists the tag , the value of that field has to be divided by 100.

In other words:

<value>44000</value> has to be transformed to <value>440</value>

The original xml can have any structure, the XSLT needs to iterate through the nodes and find that tag.

Thanks!

Was it helpful?

Solution

Use the identity transformation template

  <xsl:template match="@*|node()">
    <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
   </xsl:template>  

and

<xsl:template match="foo">
  <xsl:copy>
    <xsl:value-of select=". div 100"/>
  </xsl:copy>
</xsl:template>

where foo is the name of the element where you want to change the value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top