Subject: Re: [xsl] preceding-sibling::node() apply template -xsl:copy From: Michael Kay <mike@xxxxxxxxxxxx> Date: Tue, 17 Apr 2012 08:05:27 +0100 |
First, it helps to understand that as far as XSLT is concerned, this thing is not an attribute. In the data model that XSLT sees, an element node has a number of namespace nodes, one for each namespace prefix that is in scope, including the default namespace if any. (Until you understand the data model and the terminology, there is no hope of understanding how namespaces work in XSLT.)Hi All, I am using a xslt identity transform and I have one more template to manipulate "EVENTHEADER" header. I am not sure ,how to do exclude the " xmlns:ns2="uri" attribute in the output using the preceding-sibling::node() apply template.
Michael Kay Saxonica
<ns2:local xmlns:ns2="uri"><EVENTHEADER>
<xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
<xsl:template match="EVENTHEADER[EVENT_TYPE]"> <xsl:copy> <xsl:apply-templates select="EVENT_TYPE[position()< 2]/preceding-sibling::node()" /> < EVENT_TYPES> <xsl:apply-templates select="EVENT_TYPE[position()< 2]" /> </EVENT_TYPES> <xsl:apply-templates select="EVENT_TYPE[last()]/following-sibling::node()" /> </xsl:copy> </xsl:template>
Input: <ns2:local xmlns:ns2="uri"><EVENTHEADER>
Actual output: <EVENTHEADER xmlns:ns2="uri">
Expected output: <EVENTHEADER> </EVENTHEADER>
Any pointer would be really helpful.
Thanks Senthil
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] preceding-sibling::node(), G. Ken Holman | Thread | [xsl] Implementing unparsed-entity-, Dan Vint |
[xsl] Implementing unparsed-entity-, Dan Vint | Date | Re: [xsl] Haskell programmer's rant, Wendell Piez |
Month |