xsl-list
[Top] [All Lists]

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?

2015-06-12 08:17:08
At 2015-06-12 13:05 +0000, Costello, Roger L. costello(_at_)mitre(_dot_)org 
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(_at_)CraneSoftwrights(_dot_)com |
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
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>