Re: Re: Re: Re: [xsl] Namespace and key function issue?

Subject: Re: Re: Re: Re: [xsl] Namespace and key function issue?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Oct 2010 18:37:42 -0400
At 2010-10-12 17:05 -0500, russurquhart1@xxxxxxxxxxx wrote:

For the bold text span it reported:

<!--
text:style-name=T7
key=
count=1
lookup=
count=1-->

Well, at least they are consistent! You are getting a node (as indicated by the count) and the value is the empty string (as indicated by both of the return values).


Ahhhh ... but that is probably because <style:style> elements have no content and only have attributes. I guess it wasn't a help to show the value ... I forgot they were empty. But the count tells you they were, indeed, actually found in the tree.

<Emphasis type="">Bold</Emphasis>

So i guess key and lookup are failing.

Can you see how I mimicked the key lookup with the XPath address?


    key=<xsl:value-of select="key('style:find_style',@text:style-name)"/>
    lookup=<xsl:value-of select="//style:style[@style:name=
                                       current()/@text:style-name]"/>

And, given that you got the same count and the same empty value, I think you've successfully loaded up the key table.

If you are using XSLT 2.0 (which is in OpenOffice 3.2), you can expose all of the attributes (but not their names) using something like:

    key=<xsl:value-of select="key('style:find_style',@text:style-name)/@*"/>
    lookup=<xsl:value-of select="//style:style[@style:name=
                                       current()/@text:style-name]/@*"/>

... or with the names by:

    key=<xsl:value-of select="key('style:find_style',@text:style-name)/
                              @*/concat(name(.),'=',.)"/>
    lookup=<xsl:value-of select="//style:style[@style:name=
                                       current()/@text:style-name]/
                                       @*/concat(name(.),'=',.)"/>

I'll try this outside OO.

Good .... and try adding other XPath addresses in your diagnostics to see if any more clues are revealed.


I hope this helps.

. . . . . . . . ken

--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread