xml - How to convert KG into LBS using XSLT -
i working on xslt, have huge xml on need perform rename , move , delete operation. of transformation done want convert kilo gram lbs.
let :
<main> <part> <weight>1</weight> <weightunits></weightunits> </part> </main>
this part of xml. want convert value of <weight>
in kg lbs , put inside <weightunits>
. first possible , if yes how can that
i guess want have like:
<xsl:template match="weight"> <xsl:copy> <xsl:value-of select=". div 0.45359237"/> </xsl:copy> </xsl:template> <xsl:template match="weightunits"> <weightunits>lb</weightunits> </xsl:template>
this assuming all weights given in kilograms.
added:
it whatever value there in
<weight>
needs convert lbs , put value in<weightunits>
i convinced making mistake here because - said in comments - weightunits
element supposed hold name of unit numerical value stored in weight
.
but if insist, need is:
<xsl:template match="weightunits"> <xsl:copy> <xsl:value-of select="../weight div 0.45359237"/> </xsl:copy> </xsl:template>
Comments
Post a Comment