character-map : character map « XSLT stylesheet « XML Tutorial

XML Tutorial
1. Introduction
2. Namespace
3. XML Schema
4. XPath
5. XSLT stylesheet
Java
XML
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 Tutorial » XSLT stylesheet » character map 
5. 42. 1. character-map
File: Transform.xslt

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

  <xsl:output method="html" use-character-maps="sample"/>

  <xsl:character-map name="sample" use-character-maps="circles">
    <xsl:output-character character="&#x9;" string="  "/>
  </xsl:character-map>

  <xsl:character-map name="circles">
    <xsl:output-character character="&#x2780;" string="&lt;img src='images/circle1.gif' width='28' height='28'/&gt;"/>
    <xsl:output-character character="&#x2781;" string="&lt;img src='images/circle2.gif' width='28' height='28'/&gt;"/>
  </xsl:character-map>

  <xsl:template match="char-test">
    <html>
      <head>
        <title>title</title>
      </head>
      <body>
        <xsl:apply-templates select="*"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="tabs">
    <pre>
      <xsl:value-of select="."/>
    </pre>
  </xsl:template>

  <xsl:template match="special-char">
    <p style="font-size: 200%;">
      <xsl:text>Here's a special character: </xsl:text>
      <xsl:value-of select="."/>
    </p>
  </xsl:template>

</xsl:stylesheet>
5. 42. character map
5. 42. 1. character-map
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.