xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Jordan <mjor...@sfu.ca>
Subject Inverse of -ESCAPE parameter with testXSLT
Date Wed, 09 May 2001 03:55:26 GMT
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 &lt;a
href="http://mercury.lib.sfu.ca/cgi-bin/ejournals/EJDB?Display=BrowseForm"&gt;Electronic
Journals Database&lt;/a&gt; (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


Mime
View raw message