[ 
https://issues.apache.org/jira/browse/XALANJ-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489714
 ] 

Henry Zongaro commented on XALANJ-2380:
---------------------------------------

I get an error like the following with every release of Xalan-J that tried 
(from Xalan-J 2.4.0 onwards).  I'm not sure how you got it to work with Xalan-J 
2.6.0

file:///d:/henry/defects/j2380/j2380.xsl; Line #15; Column #76; XSLT Error 
(javax.xml.transform.TransformerException): org.apache.xpath.objects.XRTreeFrag

That's not a very descriptive message, but what it's trying to say is that 
you're trying to apply an operation to a result-tree fragment that's not
permitted.  Section 11.1 of XSLT 1.0 [1] says, "In particular, it is not 
permitted to use the /, //, and [] operators on result tree fragments."

That's such a common requirement for users, though, that most XSLT processors 
support the node-set extension function.  There is an EXSLT namespace defined 
for it, so you can write:

<xsl:stylesheet exclude-result-prefixes="dyn" version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:dyn="http://exslt.org/dynamic"; xmlns:exsl="http://exslt.org/common";>
  ...
  <xsl:value-of 
select="dyn:evaluate('exsl:node-set($employees)/employee/name/last/text()')"/>

I hope that helps.

[1] http://www.w3.org/TR/xslt#section-Result-Tree-Fragments

> dyn:evaluate gives no result the second time it is called. When using a 
> variable with no rtf. It is working in version 2.6.0
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2380
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2380
>             Project: XalanJ2
>          Issue Type: Bug
>         Environment: Windows XP, JDK 1.6.0
>            Reporter: Kenneth Reistad
>            Priority: Critical
>             Fix For: The Latest Development Code
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet exclude-result-prefixes="dyn" version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> xmlns:dyn="http://exslt.org/dynamic";>
>       <xsl:output encoding="ISO-8859-1" indent="yes" method="xml" 
> omit-xml-declaration="no" version="1.0"/>
>       <xsl:template match="/">
>               <root>
>                       <xsl:variable name="employees">
>                               <employee>
>                                       <name>
>                                               <first>Firstname0</first>
>                                               <last>Lastname0</last>
>                                       </name>
>                               </employee>
>                       </xsl:variable>
>                       
>                       <xsl:variable name="employee" 
> select="$employees/employee"/>
>                       
>                       <xsl:value-of 
> select="dyn:evaluate('$employees/employee/name/last/text()')"/>|
>                       <xsl:value-of 
> select="dyn:evaluate('$employees/employee/name/last/text()')"/>|
>                       <xsl:value-of 
> select="dyn:evaluate('$employees/employee/name/last/text()')"/>|
>                       ***
>                       <xsl:value-of 
> select="dyn:evaluate('$employee/name/last/text()')"/>|
>                       <xsl:value-of 
> select="dyn:evaluate('$employee/name/last/text()')"/>|
>                       <xsl:value-of 
> select="dyn:evaluate('$employee/name/last/text()')"/>|
>               </root>
>       </xsl:template>
> </xsl:stylesheet>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to