Subject: xsl:copy-of
From: Mayura Malagala <TS2664@xxxxxxxxxxxx>
Date: Mon, 21 May 2001 13:00:32 +0400
|
Hi,
I have a XML document which resembles,
<?xml version="1.0" encoding="ISO-8859-1"?>
<CONTENT TYPE="PR">
<HEADER>Header</HEADER>
<TITLE>Title</TITLE>
<SDATE>09-Feb-2000</SDATE>
<SUMMARY>
<STEXT>Description</STEXT>
<IMGSRC SIZE="1">images/dwc_m.gif</IMGSRC>
</SUMMARY>
<SUBTITLES>
<SUBTITLE ID="1">
<KEYWORDS>Keyword</KEYWORDS>
<HEADING>The Event</HEADING>
<LINKTXT TXTMAXLEN="">The Event</LINKTXT>
<BODY><![CDATA[SomeData]]></BODY>
<IMGSRC SIZE="">images/dwc_m.gif</IMGSRC>
<IMGCAPT>Image caption</IMGCAPT>
</SUBTITLE>
</SUBTITLES>
<RELATEDLINKS>
<RLINK ID="1" TARGET="POPUP">
<LTEXT MAXLEN="">Some heading</LTEXT>
<URL>http://www.something.com</URL>
</RLINK>
</RELATEDLINKS>
<FOOTER>footer</FOOTER>
</CONTENT>
I need to tranform this XML into encoding type "ISO-8859-6" (Arabic). I'm
using the Oracle-XML Parser via Java to perform the transformation.
So I used this XSLT,
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >
<xsl:output method="xml" encoding="ISO-8859-6" cdata-section-elements="BODY"
/>
<xsl:apply-templates select="/" />
<xsl:template match="/">
<xsl:copy-of select="/" />
</xsl:template>
</xsl:stylesheet>
This does the job fine. Now I want to make my XSLT more generic so I don't
have to specifically say that the "<BODY>" is a CDATA section. Basically I
want an exact copy of the original document whatever the original document
may be.
I tried,
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >
<xsl:output method="xml" encoding="ISO-8859-6" cdata-section-elements="BODY"
/>
<xsl:apply-templates select="/" />
<xsl:template match="/">
<xsl:copy-of select="document()" />
</xsl:template>
</xsl:stylesheet>
but this doesn't work.
Much appreciated if you could give me a hint on how to do this. And also any
pointers on whether I'm doing something completely wrong.
Thanks and regards,
Mayura
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- xsl:copy-of
- Mayura Malagala - Mon, 21 May 2001 04:59:09 -0400 (EDT) <=
|
|