given xml this:
<?xml version="1.0" encoding="utf-8"?> <products> <product someid="1efad9659ec"> <identifiers> <identifier id="234532423" name="globaltradeitemnumber (gtin)" value="00671657621322" /> <identifier id="99845898" name="internal supplier part #" value="del 20 10b015000" /> <identifier id="49348598" name="mfg model # (series)" value="del 20 10b015000" /> <identifier id="439854985" name="mfg part # (oem)" value="del 20 10b015000" /> <identifier id="2349832489" name="upc" value="671657621322" /> </identifiers> </product> <product someid="1efad9659ec"> <identifiers> <identifier id="234532423" name="globaltradeitemnumber (gtin)" value="51651518" /> <identifier id="99845898" name="internal supplier part #" value="tim 20 10b015000" /> <identifier id="49348598" name="mfg model # (series)" value="tom 20 10b015000" /> <identifier id="439854985" name="mfg part # (oem)" value="tak 20 10b015000" /> <identifier id="2349832489" name="upc" value="87468387468" /> </identifiers> </product> . . .
i want end like
... <product upc="671657621322"/> <product upc="87468387468"/> ...
but i'm getting is
... <product upc="true"/> <product upc="true"/> ...
i keep getting boolean answer select rather value of attribute. silly thing doing wrong here? xslt i'm trying:
... <xsl:template match="/"> <output> <xsl:apply-templates /> </output> </xsl:template> <xsl:template match="product"> <xsl:variable name="productcode" select="./identifiers/identifier/@name='upc'"/> <product upc="{$productcode}"> </product> </xsl:template> ...
thanks.
you using wrong xpath selection. use:
select="identifiers/identifier[@name='upc']/@value"
Comments
Post a Comment