I want to generate a xml file by using xslt version 1.0. But I'm not able to update the element value of xml node in output file Eg.
Input xml file
<Node>
<product>
<productSelected>false</productSelected>
<productId>L0001</productId>
</product>
<product>
<productSelected>true</productSelected>
<productId>L0002</productId>
</product>
<product>
<productSelected>true</productSelected>
<productId>L0003</productId>
</product>
<product>
<productSelected>false</productSelected>
<productId>L0004</productId>
</product>
</Node>
XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="Node/product"/>
</xsl:template>
<xsl:template match="Node/parent/productSelected">
<xsl:choose>
<xsl:when test=". = 'true'">
<xsl:element name="status">
<xsl:value-of select="true()" />
</xsl:element>
</xsl:when>
</xsl:template>
</xsl:stylesheet>
Output xml
<status>true</status>
<status>true</status>
In output, there is a two nodes with same name I'm just expecting a single node instead of two duplicate nodes Eg. Output should be
<status>true</status>
child
nodes withstatus
and update their values to boolean. Am i right? What should be as result. Provide entire output xml. – Maciej Losxsl:output omit-xml-declaration="yes" indent="yes"/>
declaration. – Maciej Los