Hi Mukul,
I don't think that the xsl:copy-of is the best solution as you can see from the example xml code that I provided you in my first message the "content" element contains html tags and custom xml tags. I would like to deep copy html tags and apply templates to custom xml tags. If I use xsl:copy-of then the custom tags will not be applied.
Mukul Gandhi wrote:
Hi Kostas, I think you need xsl:copy-of instead xsl:copy.. xsl:copy does shallow copy, whereas xsl:copy-of does deep copy..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsl:apply-templates select="content" />
</xsl:template> <xsl:template match="content">
<xsl:copy-of select="." /> </xsl:template>
</xsl:stylesheet>
Regards, Mukul
On Apr 8, 2005 1:31 PM, Kostas Karadamoglou <[EMAIL PROTECTED]> wrote:
Hi all,
My problem is the following:
In an xml-schema I have defined an element (content) that contains mixed data. Specifically contains strings coupled with html tags and the "code" element. Below I have an example of an instance:
<content> <p>Before the code</p> <code lang="xml"> <![CDATA[ System.out.println("Hello"); ]]> </code> <p>After the code</p> </content>
I have tried to create a template for the "content" but I cannot do it properly. The xslt applies correctly the template of code but not the remaining data (html script). It does not print the html tags.
The generated html returns the following html segment (notice that it also returns the "content" tags):
<content> Before the code
<i>System.out.println("Hello");</i>
After the code </content>
Below I include the xslt template of the content element:
<xsl:template match="content"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template>
Do you know how I will force xslt to print the html tags?
Thank you in advance, Kostas
