Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Copy text with xsl

File: Data.xml <wine>   <grape>A</grape>   <brand>B</brand> </wine> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   version="1.0">   <xsl:output method="xml" omit-xml-declaration="yes" indent="no" />   <xsl:template match="grape">     <product>       <xsl:value-of select="../brand" />       <xsl:text/>       <xsl:apply-templates />     </product>   </xsl:template>   <xsl:template match="brand" /> </xsl:stylesheet> Output:   <product>BA</product>