Subject: Re: [xsl] Cannot include namespaces [XSLT 1.0] xsltproc From: pankaj.c@xxxxxxxxxxxxxxxxxx Date: Mon, 23 Aug 2010 20:03:46 +0530 |
>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"> <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?? Just for clarity here how my xml starts' <?xml version="1.0" encoding="utf-8"?><!DOCTYPE chapter PUBLIC "-//ES//DTD book DTD version 5.2.1//EN//XML" "book521.dtd" [<!ENTITY gr7 SYSTEM "gr7" NDATA IMAGE><!ENTITY gr1 SYSTEM "gr1" NDATA IMAGE>]> <chapter xmlns:sb="http://www.elsevier.com/xml/bk/dtd" xmlns:ce=" http://www.elsevier.com/xml/common/dtd" version="5.2" xml:lang="en" docsubtype="chp" id="c0030"><ce:footnote id="fn0010"><ce:label>1</ce:label> ......................... And so on .................... Stylesheet: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:aid=" http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5=" http://ns.adobe.com/AdobeInDesign/5.0/" xmlns:sb=" http://www.elsevier.com/xml/bk/dtd" xmlns:ce=" http://www.elsevier.com/xml/common/dtd" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="UTF-8" indent="no" media-type="text/xml" method="xml"/> <xsl:strip-space elements="*"/> <!-- first template copies input to output --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="chapter"> <chapter> <xsl:attribute name="aid:pstyle"/> <xsl:attribute name="aid:cstyle"/> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </chapter> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Cannot include namespaces, David Carlisle | Thread | Re: [xsl] Cannot include namespaces, David Carlisle |
Re: [xsl] Cannot include namespaces, David Carlisle | Date | Re: [xsl] Cannot include namespaces, David Carlisle |
Month |