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

xsl:copy-of

Subject: xsl:copy-of
From: Mayura Malagala <TS2664@xxxxxxxxxxxx>
Date: Mon, 21 May 2001 13:00:32 +0400
xsl copy of document
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

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.