0

Lets say i wanted to add a node copyVar on the desired output then get the value of ID from the target XML how can i do that in XSLT? Thanks for the help

target XML:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<customer_account_create>
  <Customer>
    <Name>Bam</Name>
    <ID>1</ID>
    <Lastname>Test01</Lastname>
    <addr>Alabang</addr>	
  </Customer>
</customer_account_create>

desired output :

<?xml version="1.0" encoding="UTF-8"?>
<customer_account_create>
    <Customer>
        <ID>1</ID>
        <Name>Bam</Name>
        <Lastname>Testme</Lastname>
        <addr>NY</addr>
        [B][I]<copyVar>1</copyVar>[/I][/B]
    </Customer>
</customer_account_create>
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by xml_looser
0
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output indent="yes" method="xml"/>
	<xsl:template match="/">
		<xsl:apply-templates select="customer_account_create"/>
	</xsl:template>
	<xsl:template match="customer_account_create">
		<customer_account_create>
			<xsl:apply-templates select="Customer"/>
		</customer_account_create>
	</xsl:template>

	<xsl:template match="Customer">
		<xsl:copy>
			<xsl:copy-of select="child::*"/>
			<copyvar><xsl:value-of select="ID"/></copyvar>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.