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

prevent xslt ant task using xalan from converting CDA

Subject: prevent xslt ant task using xalan from converting CDATA to spaces
From: bvijaykr1@xxxxxxxxxxx
Date: Wed, 25 Feb 2004 19:10:26 +0000
jsp xsl
Hi,

I run an xslt target in mu build.xml using xalan.
The input code of:
<![CDATA[<!-- $Id: about.jsp,v 1.12 2004/02/24 21:10:30 gturner Exp $ -->]]>

gets transformed into:
&lt;!-- $Id: about.jsp,v 1.12 2004/02/24 21:10:30 gturner Exp $ --&gt;

How do I prevent the CDATA from being transformed into spaces ? I need to preserve my CDATA as it is in the input file for each *.jsp.

My ant target uses the foll taskdef :
 <xslt style="src/metadata/transform/jsp.xsl"
          basedir="src/web"
          includes="*.jsp"
          destdir="build/phoenix-war-jsp"
          extension=".jsp"
          force="true">
      <factory>
        <attribute name="http://xml.apache.org/xalan/properties/source-location"
                   value="true"/>
      </factory>
      <xmlcatalog refid="project.xmlcatalog"/>
    </xslt>


1.jsp.xsl code:

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: jsp.xsl,v 1.1 2004/02/24 00:08:06 gturner Exp $ -->
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" />--> 
  <xsl:import href="jsp-output.xsl"/>
  <xsl:import href="jsp-jamon.xsl"/>
</xsl:stylesheet>

2. jsp-jamon.xsl code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: jsp-jamon.xsl,v 1.1 2004/02/24 00:08:07 gturner Exp $ -->
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:jsp="http://java.sun.com/JSP/Page"
                xmlns:xalan="http://xml.apache.org/xalan"
                xmlns:ni="xalan://org.apache.xalan.lib.NodeInfo"
                exclude-result-prefixes="xalan ni">
  <!--<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" />-->
  <xsl:template match="jsp:root">
    <xsl:copy>
      <!-- Evil work-around for Xalan warning message about not being able to
           copy the jsp:root version attribute which is mandatory for JSP -->
      <xsl:attribute name="version">1.2</xsl:attribute>

      <jsp:directive.page import="com.jamonapi.*"/>

      <jsp:scriptlet>
        <xsl:text>Monitor mon=MonitorFactory.start("</xsl:text>
        <xsl:value-of select="substring-after(ni:systemId(), 'src/web/')"/>
        <xsl:text>");</xsl:text>
      </jsp:scriptlet>

      <xsl:apply-templates select="node()|@*"/>

      <jsp:scriptlet>
        <xsl:text>mon.stop();</xsl:text>        
      </jsp:scriptlet>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

3. jsp-output.xsl code:

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: jsp-output.xsl,v 1.1 2004/02/24 00:08:07 gturner Exp $ -->
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xalan="http://xml.apache.org/xslt">
    
  <xsl:output method="xml"
              encoding="ISO-8859-1"
              indent="yes"
              xalan:indent-amount="2"/>

  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

TIA,
Vijay



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.