Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Multiple Outputs (3/3) >

Character maps

With xsl:character-map a uniform substitution of specified characters by a string can be achieved. xsl:character-map must be a child of xsl:stylesheet and it contains one or more xsl:output-characters. The character specifies the original character which is replaced by the value of attribute string.

Element xsl:result-documentCan have an attribute use-character-maps which specifies one or several named character maps to be used for the required substitution.

In the example the standard output does not use any character map while output to file "aaa.xml" substitutes some characters.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>
            <xsl:param  name="outdir">/path/to/outdir</xsl:param>
            <xsl:character-map  name="cmap">
                  <xsl:output-character  character="@"
                              string=" at "/>
                  <xsl:output-character  character=""
                              string="?!"/>
            </xsl:character-map>

            <xsl:template  match="/aaa">
                  <xsl:copy-of  select="*"/>
                  <xsl:result-document  href="{$outdir}/aaa.xml"
                              use-character-maps="cmap">
                        <xsl:copy-of  select="*"/>
                  </xsl:result-document>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>joe@adultinternetusers</bbb>
            <ccc>AࢮB</ccc>
      </aaa>
Output

      <bbb>joe@adultinternetusers</bbb>
      <ccc>AࢮB</ccc>
aaa.html
<body>
 
 <h1>Title</h1>
 
 <hr>
 
 <p>text</p>
 
</body>
aaa.xhtml
<body>
 
 <h1>Title</h1>
 
 <hr></hr>
 
 <p>text</p>
 
</body>
aaa.txt
 Title
 
 text
 
aaa.xml

      <body>
            <h1>Title</h1>
            <hr/>
            <p>text</p>
      </body>


Previous chapter: Multiple stylesheets
Next chapter: Context
Previous page: Output in different formats: Surf, html, xhtml, and text
Next page: - - -

Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks