[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Validation XSLT using XSLT 1.0

Subject: Re: Validation XSLT using XSLT 1.0
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 03 Jul 2008 11:40:56 +0200
Re:  Validation XSLT using XSLT 1.0
Michael Kay schrieb:
Does anyone know of a tool that parses an XML document and
outputs it as ASCII replacing characters with named entities
instead of numeric entites? Named entites you'd probably have
to supply yourself?

You can do that in XSLT 2.0 with an identity transformation, serializing the result using character maps.

Thanks! This works great for me, and it'll also work for Ganesh to solve the second problem in his original post to this thread if he upgrades to XSLT 2.0.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output use-character-maps="Zeichen"/>
  <xsl:character-map name="Zeichen" use-character-maps="Umlaute-und-_">
    <xsl:output-character character="&#160;" string="&amp;nbsp;"/>
  </xsl:character-map>
  <xsl:character-map name="Umlaute-und-_">
    <xsl:output-character character="&#196;" string="&amp;Auml;"/><!--D-->
    <xsl:output-character character="&#214;" string="&amp;Ouml;"/><!--V-->
    <xsl:output-character character="&#220;" string="&amp;Uuml;"/><!--\-->
    <xsl:output-character character="&#223;" string="&amp;szlig;"/><!--_-->
    <xsl:output-character character="&#228;" string="&amp;auml;"/><!--d-->
    <xsl:output-character character="&#246;" string="&amp;ouml;"/><!--v-->
    <xsl:output-character character="&#252;" string="&amp;uuml;"/><!--|-->
  </xsl:character-map>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:transform>

I had my employer buy a copy of the 4th edition of your XSLT 2.0 and
XPath 2.0 reference. I used it to read up on character references and
are very pleased with both the contents and the page-number-annotated
cross-references. I haven't read more yet, but I'm sure this is as
excellent a book as many people on this list have pointed out. Thanks!

Michael Ludwig

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.