[
https://issues.apache.org/jira/browse/XALANJ-2775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mukul Gandhi resolved XALANJ-2775.
----------------------------------
Resolution: Fixed
I'm resolving this jira issue as fixed. The fix for this jira issue has been
committed to Xalan-J's dev repos xsl3 branch.
> Attempt to store result of xsl:evaluate in variable and use that variable
> afterwards results in error "Variable $array accessed before it is bound"
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: XALANJ-2775
> URL: https://issues.apache.org/jira/browse/XALANJ-2775
> Project: XalanJ2
> Issue Type: Bug
> Security Level: No security risk; visible to anyone(Ordinary problems in
> Xalan projects. Anybody can view the issue.)
> Components: transformation, Xalan, Xalan-CmdLine
> Affects Versions: The Latest Development Code
> Reporter: Martin Honnen
> Assignee: Mukul Gandhi
> Priority: Major
> Attachments: sample1.xml, xsl-evaluate-array-literal1.xsl
>
>
> Tbis is a bug report against the Xalan XSLT 3 development branch.
>
> I am trying to store the result of `xsl:evaluate` in a variable and
> afterwards use that variable. However, that results in an error "Variable
> $array accessed before it is bound".
> The code runs fine with Saxon HE 12.
> Here is the sample XSLT:
>
>
> {code:java}
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="3.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:array="http://www.w3.org/2005/xpath-functions/array"
> exclude-result-prefixes="xs array">
> <xsl:output method="xml" indent="yes"/>
>
> <xsl:template match="data">
> <xsl:variable name="array" as="item()">
> <xsl:evaluate xpath="." context-item="."/>
> </xsl:variable>
> <xsl:value-of select="array:sort($array)"/>
> </xsl:template>
> <xsl:template match="@* | node()">
> <xsl:copy>
> <xsl:apply-templates select="@* | node()"/>
> </xsl:copy>
> </xsl:template>
> <xsl:template match="/">
> <xsl:copy>
> <xsl:apply-templates/>
> <xsl:comment>Run with <xsl:value-of
> select="system-property('xsl:vendor')"/> at <xsl:value-of
> select="current-dateTime()"/></xsl:comment>
> </xsl:copy>
> </xsl:template>
> </xsl:stylesheet>
> {code}
>
>
> Here is the sample XML input:
> {code:java}
> <root>
> <data>[3, 2, 1]</data>
> </root>{code}
>
> Full output:
> {noformat}
> file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/xsl-evaluate-array-literal1.xsl;
> Zeilennummer14; Spaltennummer48; javax.xml.transform.TransformerException:
> Variable $array accessed before it is bound!.{noformat}
>
> Output expected:
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
> 1 2 3
> </root>{code}
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]