You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Derek Settle <De...@2roam.com> on 2000/05/05 08:38:38 UTC
VariableReference given for variable out of context or without de
finition!
I'm currently encountering the following error with the release of Xalan
1.0.1:
-----
XSL Error: pattern = 'starts-with($link, 's')'
VariableReference given for variable out of context or without definition!
Name
= link, source tree node: area
XSL Error: SAX Exception
pattern = 'starts-with($link, 's')'
VariableReference given for variable out of context or without definition!
Name
= link
-----
This works fine with past Xalan releases and also with Stylus engine.
I realize this may have been a bug in the way I was coding the style-sheet
but is there a way to get this to work without having to completely re-write
all existing style-sheets which use the same methodology?... (I never
realized I was coding a hack when I initially started with XSL... I think
this approach should actually be an enhancement!)
Here is the template rule being used which than generates the error output:
-----
<xsl:template name="navigation">
<xsl:param name="page">default</xsl:param>
<xsl:variable name="counter">1</xsl:variable>
<xsl:variable name="help"></xsl:variable>
<xsl:variable name="help_href"></xsl:variable>
<xsl:variable name="link"></xsl:variable>
<xsl:for-each select="descendant::area">
<xsl:if test="normalize-space(@alt)!='' or
normalize-space(@href)='p?p=t'">
<xsl:choose>
<!-- <xsl:when test="contains(normalize-space(@alt),'stores')
or contains(normalize-space(@alt),'brands') or
contains(normalize-space(@alt),'departments') or
contains(normalize-space(@alt),'Help') or
contains(normalize-space(@alt),'Change')"> -->
<xsl:when test="contains(normalize-space(@alt),'stores') or
contains(normalize-space(@alt),'departments') or
contains(normalize-space(@alt),'Help') or
contains(normalize-space(@alt),'Change') or
contains(normalize-space(@href),'p?p=t')">
<xsl:choose>
<xsl:when test="normalize-space($page)='stores' and
contains(normalize-space(@alt),'stores')">
<!-- don't show link -->
</xsl:when>
<xsl:when test="normalize-space($page)='brands' and
contains(normalize-space(@alt),'brands')">
<!-- don't show link -->
</xsl:when>
<xsl:when test="normalize-space($page)='departments'
and contains(normalize-space(@alt),'departments')">
<!-- don't show link -->
</xsl:when>
<xsl:when test="normalize-space($page)='Home' and
contains(normalize-space(@alt),'brands')">
<!-- don't show link -->
</xsl:when>
<xsl:when test="normalize-space($page)='Home' and
contains(normalize-space(@alt),'Help')">
<xsl:variable name="help"
select="normalize-space(@alt)"/>
<xsl:variable name="help_href" select="@href"/>
</xsl:when>
<xsl:when test="normalize-space($page)='Home' and
contains(normalize-space(@href),'p?p=t')">
<!-- don't show link -->
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains(normalize-space(@alt),
'of ')">
<xsl:variable name="link"
select="substring-after(normalize-space(@alt), 'of ')"/>
</xsl:when>
<xsl:when test="contains(normalize-space(@alt),
'Change')">
<xsl:variable name="link">
Change Shopping Area
</xsl:variable>
</xsl:when>
<xsl:when test="contains(normalize-space(@href),
'p?p=t')">
<xsl:variable name="link">
Home
</xsl:variable>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="link"
select="normalize-space(@alt)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="starts-with($link, 's')">
<xsl:variable name="link"
select="concat('S',substring-after($link, 's'))"/>
</xsl:when>
<xsl:when test="starts-with($link, 'b')">
<xsl:variable name="link"
select="concat('B',substring-after($link, 'b'))"/>
</xsl:when>
<xsl:when test="starts-with($link, 'd')">
<xsl:variable name="link"
select="concat('D',substring-after($link, 'd'))"/>
</xsl:when>
</xsl:choose>
<xsl:variable name="link" select="$link"/>
<window>
<test name="{normalize-space($link)}">
<a href="{@href}"><xsl:value-of
select="normalize-space($link)"/></a>
</test>
</window>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:if test="$help!=''">
<window>
<test name="{$help}">
<a href="{$help_href}"><xsl:value-of select="$help"/></a>
</test>
</window>
</xsl:if>
</xsl:template>
----
Regards, and thanks for any help you can provide!
Derek Settle
dereks@2roam.com