Copy text with : text « XSLT stylesheet « XML






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

1.Start a new line with
2.Use text() function to get text
3.match an element and get text with text() function
4.Get value with