Subject: Re: [xsl] problem with transforming mixed content From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 15 Aug 2020 07:23:10 -0000 |
Am 15.08.2020 um 08:46 schrieb Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx:
Dear Gerrit,
Thank you for the explanation! I understand now why I get the @xmlns attribute with Dimitre's solution. But I still don't understand why I also get it with Graydon's solution, which does not use <xsl:copy> but serialize() followed by parse-xml-fragment(). In the input data, the @xmlns attribute is not on the <i> element itself but on an ancestor element several levels up. Why then does it show up in the result of serialize()? And how do I get rid of it using Graydon's approach?
Neither serialization nor parsing loses any namespaces present in the input tree so while your input markup might have a namespace declaration high up in the tree each node in the tree carries its namespace information and if you have serialize and parse the namespace information is preserved.
<xsl:template match="*" mode="strip-namespace"> <xsl:element name="local-name()"> <xsl:apply-templates select="@* | node()" mode="#current"/> </xsl:element> </xsl:template>
<xsl:apply-templates select="serialize(node()) => substring-before(':') => lower-case() => parse-xml-fragment()" mode="strip-namespace"/>
If that doesn't work you might want to summarize which input you have and how your current XSLT based on Graydon's suggestion looks, plus the result you want and the one you get.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] problem with transforming, Wolfhart Totschnig w | Thread | Re: [xsl] problem with transforming, Michael Kay mike@xxx |
Re: [xsl] problem with transforming, Wolfhart Totschnig w | Date | Re: [xsl] problem with transforming, Michael Kay mike@xxx |
Month |