xsl-list
[Top] [All Lists]

Re: [xsl] Algorithm akin to namespace fixup for xslt?

2015-02-06 04:11:16
Given a deep tree of nodes, each element node within a namespace. A child 
node inherits its parent namespace unless it specifically overrides it. Is 
there an algorithm for choosing the "best" or perhaps "sparsest" set of 
overriding namespace declarations, hence taking the most advantage of 
inheritance.

My application of this algorithm isn't for namespaces but seems very similar 
in requirement.


That's a pretty sketchy description, not helped by the fact that you appended 
text from another thread which I assume is to be ignored.

Let's try another formulation, which might or might not be what you intended: 
Given a document with lots of xml:lang attributes, eliminate those that are 
redundant.

That one's fairly easy, I think:

<xsl:mode on-no-match="shallow-copy"/>
<xsl:template match="@xml:lang[. eq ancestor::*[@xml:lang][1]/@xml:lang"/>

Michael Kay
Saxonica
--~----------------------------------------------------------------
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>