Re: [xsl] Cannot include namespaces [XSLT 1.0] xsltproc

Subject: Re: [xsl] Cannot include namespaces [XSLT 1.0] xsltproc
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 23 Aug 2010 15:39:51 +0100
On 23/08/2010 15:33, pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
you have used xsl:copy which copies an element (along with its namespace
context) from the source rather than use a literal result element, or
xsl:element which generates an element node using the namespace context
in the stylesheet.

You mean something like this


<xsl:template match="chapter">
<xsl:element name="chapter">

well not exactly. If you do that then the element is created using the namespace context of the stylesheet but if you use xsl:element (in xslt 1) only the namespace used in the element name is copied. It seems you want all the namespaces from the stylesheet copied which (in xslt 1) requires you to use a literal result eleemnt


<xsl:template match="chapter">
<chapter>
...

however that would cause the namespaces to be declared on every chapter
which was why I suggested using this technique instead on the top level element (book?) so that they just get decared once. Of course, if chapter is your top level element this comes to the same thing.




<xsl:attribute name="aid:pstyle"/>
<xsl:attribute name="aid:cstyle"/>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

I did tried this but do not know what could be the reason for not
outputting.



<xsl:template match="/x:book">
<book>
Could you be please more clear about this??


see above


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