xsl-list
[Top] [All Lists]

Re: [xsl] How to query a temporary document in a variable

2012-09-10 07:44:55
On 10 September 2012 13:38, Jean-Pierre Bergamin 
<jpbergamin(_at_)gmail(_dot_)com> wrote:
Hello xslt-users

I'm trying to use a temporary document as a lookup table with saxon
9.4 using xslt 2.0. The solution is also proposed in this
stackoverflow answer:
http://stackoverflow.com/questions/3626118/xslt-creating-a-map-in-xslt

But I'm not getting any results when I query the variable that holds
the temporary document:

<xsl:variable name="propertyMap">
        <entry key="foo">foo value</entry>
        <entry key="bar">bar value</entry>
</xsl:variable>

<xsl:template match="/">
        <xsl:value-of select="$propertyMap/entry[position() = 1]"/>
        <xsl:value-of select="$propertyMap/entry[@key='foo']"/>
        <xsl:value-of select="$propertyMap[1]"/>
</xsl:template>

The first two value-of expressions do not output anything, whereas the
third one outputs the whole propertyMap.

Any idea what I'm missing here?

You've probably changed the default namespace on the stylesheet
element... or less likely set the xpath-default-namespace...

If neither of those, post a small, complete runnable sample.


-- 
Andrew Welch
http://andrewjwelch.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--