Copy text with : text « XSLT stylesheet « XML
- XML
- XSLT stylesheet
- text
Copy text with
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>
Related examples in the same category