You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Mark Jordan <mj...@sfu.ca> on 2001/05/09 05:55:26 UTC
Inverse of -ESCAPE parameter with testXSLT
Hi,
How do I tell testXSLT _not_ to escape certain characters? For example, I
have a source document
<FAQ ID="75">
<QUESTION>How do I access electronic journals?</QUESTION>
<ANSWER>
<![CDATA[
Electronic journals to which SFU Library subscribes are accessible through
our <a href="http://mercury.lib.sfu.ca/cgi-bin/ejournals/
EJDB?Display=BrowseForm">Electronic Journals Database</a> (EJDB). See the
"About" link at the EJDB for more information.
]]>
</ANSWER>
</FAQ>
and the stylesheet
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="FAQ">
<html>
<head><title><xsl:apply-templates select="QUESTION"/></title></head>
<body>
<xsl:apply-templates select="ANSWER"/>
</body>
</html>
</xsl:template>
<xsl:template match="QUESTION">
<i><xsl:value-of select="."/></i>
</xsl:template>
<xsl:template match="ANSWER">
<i><xsl:value-of select="."/></i>
</xsl:template>
</xsl:stylesheet>
Running 'testXSLT -Q -XML -NH -in cdatatest.xml -xsl cdatatest.xsl
-STRIPCDATA' produces the output
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
<i>How do I access electronic journals?</i>
</title>
</head>
<body>
<i>
Electronic journals to which SFU Library subscribes are accessible through
our <a
href="http://mercury.lib.sfu.ca/cgi-bin/ejournals/EJDB?Display=BrowseForm">Electronic
Journals Database</a> (EJDB). See the "About" link at the EJDB for
more information.
</i>
</body>
</html>
but I want the output
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
<i>How do I access electronic journals?</i>
</title>
</head>
<body>
<i>
Electronic journals to which SFU Library subscribes are accessible through
our
<href="http://mercury.lib.sfu.ca/cgi-bin/ejournals/EJDB?Display=BrowseForm">Electronic
Journals Database</a> (EJDB).
</i>
</body>
</html>
testXSLT options include "-ESCAPE (Specifies which characters to escape.
{default is <>&"'\r\n}", but I want the unescaped CDATA section to be
parsed with no escapes. Anyone know how to use the -ESCAPE option to
override the defaults?
Mark
Mark Jordan
Librarian / Analyst, Systems Division
W.A.C. Bennett Library, Simon Fraser University
Burnaby, British Columbia, V5A 1S6, Canada
Phone (604) 291 5753 / Fax (604) 291 3023
mjordan@sfu.ca / http://www.sfu.ca/~mjordan/
---------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org