[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] Algorithm akin to namespace fixup for xslt?
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Feb 2015 09:24:20 -0000

Namespaces are meant to keep sets of identifiers from clashing and attach
some specific semantics to the names they are attached to. Any messing will
destroy the integrity of an XML document.

You may have to reformulate your problen to make clear what kind of
algorithm you really need, and this list may not be the best place to
inquire for it.

-W

On 6 February 2015 at 09:44, Alan Painter alan.painter@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Dear xslt community members,
>
> I'm wondering if there isn't a known, public algorithm ), ideally in XSLT
> itself, for doing something akin to "namespace fixup".
>
> 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.
>
> Thanks for any pointers or suggestions
> On Feb 5, 2015 8:31 PM, "Mailing Lists Mail daktapaal@xxxxxxxxx" <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> <xsl:variable name="foo" select = "xxx"/>
>
>   <xsl:variable name="bar" select= "yyy"/>
>
> <xsl:variable name="foo1"/>
>
>   <xsl:variable name="bar1" select= "'world'"/>
>
>
>   <xsl:value-of select="($foo,$bar)[1]"/> <!--first-->
>
>     <xsl:value-of select="(string($foo1),$bar1)[1]"/><!--Second-->
>
> First worked but second did not work
> I was expecting "World" to be output to the result ..
>
>
> On Thu, Feb 5, 2015 at 1:36 PM, Michael Kay mike@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> > If $a and $b have cardinality zero-or-one then ($a, $b)[1] does what you
> want (and is a common programming idiom).
> >
> > But be careful, it doesn't work if either $a or $b can contain more than
> one item.
> >
> > Also, it tests whether $a exists, which isn't the same as your example
> of testing the effective boolean value of string(@a).
> >
> > Michael Kay
> > Saxonica
> > mike@xxxxxxxxxxxx
> > +44 (0) 118 946 5893
> >
> >
> >
> >
> > On 5 Feb 2015, at 18:32, Mailing Lists Mail daktapaal@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> >> Hey All,
> >> I have a logic that says :
> >>
> >> if $a found , then use it, else use $b.
> >> I can do this like
> >>
> >> <xsl:value-of select = "if(string($a)) then $a else $b"/>
> >>
> >> Can I do something like
> >> <xsl:value-of select = "($a,$b)[1]"/>
> >>
> >> Not sure , when this will work and when it wont. Or will it work at
> all..
> >>
> >
>
>   XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <-list/528976> (by
> email <>)


Current Thread
Keywords