Re: [xsl] merging multiple xsl's - creates new node and ignores CDATA tags

Subject: Re: [xsl] merging multiple xsl's - creates new node and ignores CDATA tags
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 13 Nov 2007 11:09:55 GMT
> This do the merging, but adds an <xsl:include> node on the output as
> shown below

It pnly pits thattheer because you have explictly copied it using
<xsl:copy>
in the branch handling xsl:include, just remove that and it won't be
copied.

Why matchch on all nodes and then use an xsl:choose to distinguish
xsl:include, especially using name(0 which is likely to be slow and
potentially unreliable (as namespace prefixes  may be different)
Just use template matching.

	<xsl:template match="node()|@*">
... ideentity transfrom

and then  just have

<xsl:template match="xsl:include">
	<xsl:apply-templates/>
</xsl:template>

similarly why have

<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE </xsl:text>

rather than using doctype-system attribute on xsl:output?

> 3) Also noticed, any opening and closing CDATA tag getting ignored
CDATA tags are handled by teh XML parser before XSLt starts, the
XSLt engine does not see them at all, so there is nothing to be done.
If you are writing htmk (rather than xhtml) you can not have markup in a
script element so <![CDATA does not start a cdata section it is just
the literal characters < ! [ C D A T A [ which (should) be reported to
the javascript engine and (should) therefore trigger a javascript syntax
error. Your browser may mask that error, but there isn't an easy way to
force XSLT to make this error (unless you use disable-output-escaping
again which is the usual way of forcing XSLt to bypass XML rules.

David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread