Re: [xsl] How to insert a snippet of XSD into HTML using serialize(), without the result containing a bunch of namespaces? Way to suppress the output of namespace declarations?

Subject: Re: [xsl] How to insert a snippet of XSD into HTML using serialize(), without the result containing a bunch of namespaces? Way to suppress the output of namespace declarations?
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Jun 2015 13:17:04 -0000
At 2015-06-12 13:05 +0000, Costello, Roger L. costello@xxxxxxxxx wrote:
In my XSLT, I am using the new serialize function to output the Title element:

<xsl:value-of select="serialize(//xs:element[@name eq 'Title'])" />

You are addressing a node in the tree with the XSD namespace nodes attached to the element node you are addressing. Those namespace nodes are being serialized.


However, when I view the HTML document in a browser, I see a bunch of namespace declarations bundled with the Title element:

Because they are part of the node tree you are asking to serialize.


I don't want all those namespace declarations. How do I omit them?

Create a copy without the namespaces you don't want (but what you create will still have to be well-formed).


I tried adding a serialization parameter to the serialize function:

I don't think that will help ... I don't think serialization suppresses information you are already asking to serialize.


<xsl:value-of select="serialize((//xs:element[@name eq 'Title'], $output-serialization-parameters)" />

That had no effect.

That doesn't surprise me.


I hope this helps.

. . . . . . Ken


-- Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/video.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: http://plus.google.com/+GKenHolman-Crane/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |


--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Current Thread