Get value with : text « XSLT stylesheet « XML

XML
1. CSS Style
2. SVG
3. XML Schema
4. XQuery
5. XSLT stylesheet
Java
XML Tutorial
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
XML » XSLT stylesheet » text 
Get value with

File: Data.xml
<?xml version="1.0"?>
<cv>
  <para>
    <performance>
      <publication>A</publication>
      B
      <venue>C</venue>
      D
      <group>E</group>
      F
      <date>1998</date>
      G
      <quote>
        test
      </quote>
      H
    </performance>
  </para>
</cv>

File: Transform.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <html>
      <body>
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="para">
    <p>
      <xsl:apply-templates />
    </p>
  </xsl:template>

  <xsl:template match="publication">
    <font face="arial">
      <xsl:apply-templates />
    </font>
  </xsl:template>

  <xsl:template match="quote">
    <xsl:text />
    "
    <xsl:apply-templates />
    "
    <xsl:text />
  </xsl:template>

  <xsl:template match="work">
    <i>
      <xsl:apply-templates />
    </i>
  </xsl:template>

  <xsl:template match="role">
    <u>
      <xsl:apply-templates />
    </u>
  </xsl:template>

</xsl:stylesheet>

Output:

<html>
   <body>
        
      <p>
             
               <font face="arial">A</font>
               B
               C
               D
               E
               F
               1998
               G
               
             "
             
                 test
               
             "
             
               H
             
           
      </p>
      
   </body>
</html>

 
Related examples in the same category
1. Start a new line with
2. Copy text with
3. Use text() function to get text
4. match an element and get text with text() function
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.