Hi all,
well, I'm about to develop a dynamic portal based on XML/XSLT, via
libxml2/libxslt, however, I'm encountering some intregal issues actually.
Assume the following in global scope:
<xsl:param name='action' select='""'/>
<xsl:variable name='result'>
<xsl:choose>
<xsl:when test='$action = "login"'>
<Redirect sid='{$sid}'>to-page-blah.xml</Redirect>
</xsl:when>
<xsl:ohterwise>
<Pass/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match='/Page'>
<xsl:choose>
<xsl:when test='$result/Redirect'>
<xsl:apply-templates select='document($result/Redirect)/Page'/>
</xsl:when>
<xsl:otherwise>
<!-- actually displays the page, w/o further pre-processing -->
<xsl:apply-templates select='.' mode='contents'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
This looks really neat, and would be ideal, HOWEVER, I can't qualify the
"result" variable as "$result/Redirect" or whatever would look like an node
access. In fact, the global variable is *not* a string, it's an element
template, exactly as the XSLT specification has declared (I read it that way
at least);
When now accessing my page with the proper arguments, libxslt errors out with
the message "Type error". Nothing more (event not *what* type error it
complains about:( ).
So now, is this a bug of libxslt's xpath or XSLT implementation regarding
xsl:variable element templates?
If not, how do I reach my goal then?
I mean, I need a way to store within a global variable more than a single
state (for example 2), and elements would just be gread to have (so the spec
says, you can use global vars to represent elements)
I could achieve this by storing a formatted pattern within $result and extract
my desired elements using xpath's string functions, but this indeed would be
really an performance overhead and wouldn't look that neat.
Thanks in advance,
Christian Parpart.
--
19:09:26 up 150 days, 8:17, 0 users, load average: 0.97, 0.48, 0.31
Attachment:
pgpOO7Vl2aRsA.pgp
Description: PGP signature