saxon-B v8.7 problem accessing ancestor nodes

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

saxon-B v8.7 problem accessing ancestor nodes

Heidi L Preston

After upgrading to v8.7 (from 8.6), I have discovered that I am loosing
access to some ancestors from my context node.

Input:
********
<exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
   <exp:schema schema_id="ap218_aim"
targetNamespace="urn:iso10303-28:schema/Ap218_aim">
      <exp:constants>
         <exp:constant constant_id="dummy_gri">
            <exp:ref name="gri"/>
            <exp:expression>ri ( '' ) || gri ( )</exp:expression>
         </exp:constant>
         <exp:constant constant_id="dummy_tri">
            <exp:ref name="tri"/>
            <exp:expression>ri ( '' ) || tri ( )</exp:expression>
         </exp:constant>
      </exp:constants>
      <exp:entity entity_id="tri"/>
      <exp:entity entity_id="gri"/>
   </exp:schema>
</exp:transfer>
********

A template is applied to each of the two occurrences of exp:ref.  When I
get to the second occurrence, I no longer have access to my
ancestor::exp:schema (although I can access my ancestor::exp:constants).
Here is the code:

**********
<xsl:key name="items" match="exp:entity" use="@entity_id" />

<xsl:template match="/">
  <xsl:apply-templates select="." mode="tester" />
</xsl:template>

<xsl:template match="/" mode="tester">
  <xsl:apply-templates select="exp:transfer" mode="tester" />
</xsl:template>


<xsl:template match="exp:*" mode="tester">
  <xsl:copy>
    <xsl:copy-of select="@*" />
    <xsl:apply-templates mode="tester" />
  </xsl:copy>
</xsl:template>


<xsl:template match="exp:ref" mode="tester">

<xsl:message>ENTER REF:<xsl:value-of select="@name"/>
COUNT CONSTANTS<xsl:value-of
select="count(parent::exp:constant/parent::exp:constants)"/>
COUNT SCHEMA<xsl:value-of
select="count(parent::exp:constant/parent::exp:constants/parent::exp:schema)"/>
NAME SCHEMA<xsl:value-of
select="ancestor::exp:schema/@schema_id"/></xsl:message>

  <xsl:variable name="item" as="element()?"
    select="key('items', @name, ancestor::exp:schema)" />

 <xsl:sequence select="$item"/>

  <xsl:message>LEAVE REF:<xsl:value-of select="@name"/></xsl:message>
</xsl:template>
********
Interestingly, if I comment out the xsl:sequence and the xsl:message above,
I am able to find the lost exp:schema.  I think I will need to revert back
to 8.6 temporarily (which behaves as desired), but I am interested in
feedback.

Thanks,
Heidi




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: saxon-B v8.7 problem accessing ancestor nodes

Michael Kay
I can't reproduce your problem. I get exactly the same output from this
stylesheet for Saxon 8.6.1 and Saxon 8.7.

Could you please supply the full stylesheet, including the missing namespace
declarations, and show the output you obtained with Saxon 8.6.1 and Saxon
8.7 respectively. Thanks.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Heidi L Preston
> Sent: 14 March 2006 15:55
> To: [hidden email]
> Subject: [saxon] saxon-B v8.7 problem accessing ancestor nodes
>
>
> After upgrading to v8.7 (from 8.6), I have discovered that I
> am loosing
> access to some ancestors from my context node.
>
> Input:
> ********
> <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
>    <exp:schema schema_id="ap218_aim"
> targetNamespace="urn:iso10303-28:schema/Ap218_aim">
>       <exp:constants>
>          <exp:constant constant_id="dummy_gri">
>             <exp:ref name="gri"/>
>             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
>          </exp:constant>
>          <exp:constant constant_id="dummy_tri">
>             <exp:ref name="tri"/>
>             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
>          </exp:constant>
>       </exp:constants>
>       <exp:entity entity_id="tri"/>
>       <exp:entity entity_id="gri"/>
>    </exp:schema>
> </exp:transfer>
> ********
>
> A template is applied to each of the two occurrences of
> exp:ref.  When I
> get to the second occurrence, I no longer have access to my
> ancestor::exp:schema (although I can access my
> ancestor::exp:constants).
> Here is the code:
>
> **********
> <xsl:key name="items" match="exp:entity" use="@entity_id" />
>
> <xsl:template match="/">
>   <xsl:apply-templates select="." mode="tester" />
> </xsl:template>
>
> <xsl:template match="/" mode="tester">
>   <xsl:apply-templates select="exp:transfer" mode="tester" />
> </xsl:template>
>
>
> <xsl:template match="exp:*" mode="tester">
>   <xsl:copy>
>     <xsl:copy-of select="@*" />
>     <xsl:apply-templates mode="tester" />
>   </xsl:copy>
> </xsl:template>
>
>
> <xsl:template match="exp:ref" mode="tester">
>
> <xsl:message>ENTER REF:<xsl:value-of select="@name"/>
> COUNT CONSTANTS<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants)"/>
> COUNT SCHEMA<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants/paren
> t::exp:schema)"/>
> NAME SCHEMA<xsl:value-of
> select="ancestor::exp:schema/@schema_id"/></xsl:message>
>
>   <xsl:variable name="item" as="element()?"
>     select="key('items', @name, ancestor::exp:schema)" />
>
>  <xsl:sequence select="$item"/>
>
>   <xsl:message>LEAVE REF:<xsl:value-of select="@name"/></xsl:message>
> </xsl:template>
> ********
> Interestingly, if I comment out the xsl:sequence and the
> xsl:message above,
> I am able to find the lost exp:schema.  I think I will need
> to revert back
> to 8.6 temporarily (which behaves as desired), but I am interested in
> feedback.
>
> Thanks,
> Heidi
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend
> the live webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> dat=121642
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: saxon-B v8.7 problem accessing ancestor nodes

Heidi L Preston
Here is the xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:exp="urn:iso10303-28:xslt/step/express">

<xsl:strip-space elements="*"/>

<xsl:output indent="yes"/>

<xsl:key name="items" match="exp:entity" use="@entity_id" />


<xsl:template match="/">
  <xsl:apply-templates select="." mode="tester" />
</xsl:template>


<xsl:template match="/" mode="tester">
  <xsl:apply-templates select="exp:transfer" mode="tester" />
</xsl:template>



<xsl:template match="exp:*" mode="tester">
  <xsl:copy>
    <xsl:copy-of select="@*" />
    <xsl:apply-templates mode="tester" />
  </xsl:copy>
</xsl:template>



<xsl:template match="exp:ref" mode="tester">

<xsl:message>HERE REF:<xsl:value-of select="@name"/>
COUNT CONSTANTS<xsl:value-of
select="count(parent::exp:constant/parent::exp:constants)"/>
COUNT SCHEMA<xsl:value-of
select="count(parent::exp:constant/parent::exp:constants/parent::exp:schema)"/>
NAME SCHEMA<xsl:value-of
select="ancestor::exp:schema/@schema_id"/></xsl:message>

   <xsl:variable name="item" as="element()?"
    select="key('items', @name, ancestor::exp:schema)" />

 <xsl:sequence select="$item"/>

  <xsl:message>LEAVE REF NAME:<xsl:value-of select="@name"/></xsl:message>
</xsl:template>



</xsl:stylesheet>

My input is exactly as shown in the original E-mail (below), and when I run
this in 8.7, I get the following output messages:
***************************************
D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon/saxon8.jar -t -o saxon.out
saxon_input.xml test.xsl
Saxon 8.7J from Saxonica
Java version 1.4.2_05
Stylesheet compilation time: 661 milliseconds
Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
Building tree for file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
class net.sf.saxon.tinytree.TinyBuilder
Tree built in 10 milliseconds
Tree size: 15 nodes, 40 characters, 8 attributes
HERE REF:gri
COUNT CONSTANTS1
COUNT SCHEMA1
NAME SCHEMAap218_aim
LEAVE REF NAME:gri
HERE REF:tri
COUNT CONSTANTS1
COUNT SCHEMA0
NAME SCHEMA
Error on line 41 of file:/D:/Projects/xslt2/Jeni/Temp/test.xsl:
  XPTY0004: An empty sequence is not allowed as the third argument of key()
Transformation failed: Run-time errors were reported

Tool completed with exit code 2
*******************************

When I run the same stylesheet and input using v8.6.1, it runs to
completion, finding the exp:schema:
********************
D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon8.6/saxon8.jar -t -o
saxon.out saxon_input.xml test.xsl
Saxon 8.6.1 from Saxonica
Java version 1.4.2_05
Stylesheet compilation time: 651 milliseconds
Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
Building tree for file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
class net.sf.saxon.tinytree.TinyBuilder
Tree built in 10 milliseconds
Tree size: 15 nodes, 40 characters, 8 attributes
HERE REF:gri
COUNT CONSTANTS1
COUNT SCHEMA1
NAME SCHEMAap218_aim
LEAVE REF NAME:gri
HERE REF:tri
COUNT CONSTANTS1
COUNT SCHEMA1
NAME SCHEMAap218_aim
LEAVE REF NAME:tri
Execution time: 160 milliseconds
Memory used: 976616
NamePool contents: 32 entries in 32 chains. 8 prefixes, 9 URIs

Tool completed successfully
******************************

And saxon.out looks like:

<?xml version="1.0" encoding="UTF-8"?>
<exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
   <exp:schema schema_id="ap218_aim"
targetNamespace="urn:iso10303-28:schema/Ap218_aim">
      <exp:constants>
         <exp:constant constant_id="dummy_gri">
            <exp:entity entity_id="gri"/>
            <exp:expression>ri ( '' ) || gri ( )</exp:expression>
         </exp:constant>
         <exp:constant constant_id="dummy_tri">
            <exp:entity entity_id="tri"/>
            <exp:expression>ri ( '' ) || tri ( )</exp:expression>
         </exp:constant>
      </exp:constants>
      <exp:entity entity_id="tri"/>
      <exp:entity entity_id="gri"/>
   </exp:schema>
</exp:transfer>


Thanks for looking at this.




                                                                           
             "Michael Kay"                                                
             <[hidden email]                                            
             m>                                                         To
             Sent by:                  <[hidden email]>  
             saxon-help-admin@                                          cc
             lists.sourceforge                                            
             .net                                                  Subject
                                       RE: [saxon] saxon-B v8.7 problem    
                                       accessing ancestor nodes            
             03/14/2006 04:58                                              
             PM                                                            
                                                                           
                                                                           
             Please respond to                                            
             saxon-help@lists.                                            
              sourceforge.net                                              
                                                                           
                                                                           




I can't reproduce your problem. I get exactly the same output from this
stylesheet for Saxon 8.6.1 and Saxon 8.7.

Could you please supply the full stylesheet, including the missing
namespace
declarations, and show the output you obtained with Saxon 8.6.1 and Saxon
8.7 respectively. Thanks.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Heidi L Preston
> Sent: 14 March 2006 15:55
> To: [hidden email]
> Subject: [saxon] saxon-B v8.7 problem accessing ancestor nodes
>
>
> After upgrading to v8.7 (from 8.6), I have discovered that I
> am loosing
> access to some ancestors from my context node.
>
> Input:
> ********
> <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
>    <exp:schema schema_id="ap218_aim"
> targetNamespace="urn:iso10303-28:schema/Ap218_aim">
>       <exp:constants>
>          <exp:constant constant_id="dummy_gri">
>             <exp:ref name="gri"/>
>             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
>          </exp:constant>
>          <exp:constant constant_id="dummy_tri">
>             <exp:ref name="tri"/>
>             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
>          </exp:constant>
>       </exp:constants>
>       <exp:entity entity_id="tri"/>
>       <exp:entity entity_id="gri"/>
>    </exp:schema>
> </exp:transfer>
> ********
>
> A template is applied to each of the two occurrences of
> exp:ref.  When I
> get to the second occurrence, I no longer have access to my
> ancestor::exp:schema (although I can access my
> ancestor::exp:constants).
> Here is the code:
>
> **********
> <xsl:key name="items" match="exp:entity" use="@entity_id" />
>
> <xsl:template match="/">
>   <xsl:apply-templates select="." mode="tester" />
> </xsl:template>
>
> <xsl:template match="/" mode="tester">
>   <xsl:apply-templates select="exp:transfer" mode="tester" />
> </xsl:template>
>
>
> <xsl:template match="exp:*" mode="tester">
>   <xsl:copy>
>     <xsl:copy-of select="@*" />
>     <xsl:apply-templates mode="tester" />
>   </xsl:copy>
> </xsl:template>
>
>
> <xsl:template match="exp:ref" mode="tester">
>
> <xsl:message>ENTER REF:<xsl:value-of select="@name"/>
> COUNT CONSTANTS<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants)"/>
> COUNT SCHEMA<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants/paren
> t::exp:schema)"/>
> NAME SCHEMA<xsl:value-of
> select="ancestor::exp:schema/@schema_id"/></xsl:message>
>
>   <xsl:variable name="item" as="element()?"
>     select="key('items', @name, ancestor::exp:schema)" />
>
>  <xsl:sequence select="$item"/>
>
>   <xsl:message>LEAVE REF:<xsl:value-of select="@name"/></xsl:message>
> </xsl:template>
> ********
> Interestingly, if I comment out the xsl:sequence and the
> xsl:message above,
> I am able to find the lost exp:schema.  I think I will need
> to revert back
> to 8.6 temporarily (which behaves as desired), but I am interested in
> feedback.
>
> Thanks,
> Heidi
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend
> the live webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> dat=121642
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: saxon-B v8.7 problem accessing ancestor nodes

Michael Kay
Thanks: I've now reproduced it. (Don't know what I did wrong last time, but
it shows the value of supplying the actual runnable code). The -T trace
shows there's something very odd going on:

<source
node="/exp:transfer/exp:schema[1]/exp:constants[1]/exp:constant[1]/exp:ref[1
]" line="6" file="test.xml">
  <xsl:template match="exp:ref" mode="tester" line="33" module="test.xsl">
      ...                  
  </xsl:template>
</source><!--
/exp:transfer/exp:transfer[1]/exp:constants[1]/exp:constant[1]/exp:ref[1]
-->

in other words, the name of the exp:schema[1] element seems to have been
corrupted somehow.

I'll look into it as soon as I can. Running with the linked tree instead of
the tinytree (-ds option) seems to circumvent the problem, which gives me
some clues as to its locality.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Heidi L Preston
> Sent: 15 March 2006 13:43
> To: [hidden email]
> Subject: RE: [saxon] saxon-B v8.7 problem accessing ancestor nodes
>
> Here is the xsl:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:exp="urn:iso10303-28:xslt/step/express">
>
> <xsl:strip-space elements="*"/>
>
> <xsl:output indent="yes"/>
>
> <xsl:key name="items" match="exp:entity" use="@entity_id" />
>
>
> <xsl:template match="/">
>   <xsl:apply-templates select="." mode="tester" />
> </xsl:template>
>
>
> <xsl:template match="/" mode="tester">
>   <xsl:apply-templates select="exp:transfer" mode="tester" />
> </xsl:template>
>
>
>
> <xsl:template match="exp:*" mode="tester">
>   <xsl:copy>
>     <xsl:copy-of select="@*" />
>     <xsl:apply-templates mode="tester" />
>   </xsl:copy>
> </xsl:template>
>
>
>
> <xsl:template match="exp:ref" mode="tester">
>
> <xsl:message>HERE REF:<xsl:value-of select="@name"/>
> COUNT CONSTANTS<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants)"/>
> COUNT SCHEMA<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants/paren
> t::exp:schema)"/>
> NAME SCHEMA<xsl:value-of
> select="ancestor::exp:schema/@schema_id"/></xsl:message>
>
>    <xsl:variable name="item" as="element()?"
>     select="key('items', @name, ancestor::exp:schema)" />
>
>  <xsl:sequence select="$item"/>
>
>   <xsl:message>LEAVE REF NAME:<xsl:value-of
> select="@name"/></xsl:message>
> </xsl:template>
>
>
>
> </xsl:stylesheet>
>
> My input is exactly as shown in the original E-mail (below),
> and when I run
> this in 8.7, I get the following output messages:
> ***************************************
> D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon/saxon8.jar -t
> -o saxon.out
> saxon_input.xml test.xsl
> Saxon 8.7J from Saxonica
> Java version 1.4.2_05
> Stylesheet compilation time: 661 milliseconds
> Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
> Building tree for
> file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
> class net.sf.saxon.tinytree.TinyBuilder
> Tree built in 10 milliseconds
> Tree size: 15 nodes, 40 characters, 8 attributes
> HERE REF:gri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:gri
> HERE REF:tri
> COUNT CONSTANTS1
> COUNT SCHEMA0
> NAME SCHEMA
> Error on line 41 of file:/D:/Projects/xslt2/Jeni/Temp/test.xsl:
>   XPTY0004: An empty sequence is not allowed as the third
> argument of key()
> Transformation failed: Run-time errors were reported
>
> Tool completed with exit code 2
> *******************************
>
> When I run the same stylesheet and input using v8.6.1, it runs to
> completion, finding the exp:schema:
> ********************
> D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon8.6/saxon8.jar -t -o
> saxon.out saxon_input.xml test.xsl
> Saxon 8.6.1 from Saxonica
> Java version 1.4.2_05
> Stylesheet compilation time: 651 milliseconds
> Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
> Building tree for
> file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
> class net.sf.saxon.tinytree.TinyBuilder
> Tree built in 10 milliseconds
> Tree size: 15 nodes, 40 characters, 8 attributes
> HERE REF:gri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:gri
> HERE REF:tri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:tri
> Execution time: 160 milliseconds
> Memory used: 976616
> NamePool contents: 32 entries in 32 chains. 8 prefixes, 9 URIs
>
> Tool completed successfully
> ******************************
>
> And saxon.out looks like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
>    <exp:schema schema_id="ap218_aim"
> targetNamespace="urn:iso10303-28:schema/Ap218_aim">
>       <exp:constants>
>          <exp:constant constant_id="dummy_gri">
>             <exp:entity entity_id="gri"/>
>             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
>          </exp:constant>
>          <exp:constant constant_id="dummy_tri">
>             <exp:entity entity_id="tri"/>
>             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
>          </exp:constant>
>       </exp:constants>
>       <exp:entity entity_id="tri"/>
>       <exp:entity entity_id="gri"/>
>    </exp:schema>
> </exp:transfer>
>
>
> Thanks for looking at this.
>
>
>
>
>                                                              
>              
>              "Michael Kay"                                    
>              
>              <[hidden email]                                
>              
>              m>                                              
>           To
>              Sent by:                  
> <[hidden email]>  
>              saxon-help-admin@                                
>           cc
>              lists.sourceforge                                
>              
>              .net                                            
>      Subject
>                                        RE: [saxon] saxon-B
> v8.7 problem    
>                                        accessing ancestor
> nodes            
>              03/14/2006 04:58                                
>              
>              PM                                              
>              
>                                                              
>              
>                                                              
>              
>              Please respond to                                
>              
>              saxon-help@lists.                                
>              
>               sourceforge.net                                
>              
>                                                              
>              
>                                                              
>              
>
>
>
>
> I can't reproduce your problem. I get exactly the same output
> from this
> stylesheet for Saxon 8.6.1 and Saxon 8.7.
>
> Could you please supply the full stylesheet, including the missing
> namespace
> declarations, and show the output you obtained with Saxon
> 8.6.1 and Saxon
> 8.7 respectively. Thanks.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of
> > Heidi L Preston
> > Sent: 14 March 2006 15:55
> > To: [hidden email]
> > Subject: [saxon] saxon-B v8.7 problem accessing ancestor nodes
> >
> >
> > After upgrading to v8.7 (from 8.6), I have discovered that I
> > am loosing
> > access to some ancestors from my context node.
> >
> > Input:
> > ********
> > <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
> >    <exp:schema schema_id="ap218_aim"
> > targetNamespace="urn:iso10303-28:schema/Ap218_aim">
> >       <exp:constants>
> >          <exp:constant constant_id="dummy_gri">
> >             <exp:ref name="gri"/>
> >             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
> >          </exp:constant>
> >          <exp:constant constant_id="dummy_tri">
> >             <exp:ref name="tri"/>
> >             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
> >          </exp:constant>
> >       </exp:constants>
> >       <exp:entity entity_id="tri"/>
> >       <exp:entity entity_id="gri"/>
> >    </exp:schema>
> > </exp:transfer>
> > ********
> >
> > A template is applied to each of the two occurrences of
> > exp:ref.  When I
> > get to the second occurrence, I no longer have access to my
> > ancestor::exp:schema (although I can access my
> > ancestor::exp:constants).
> > Here is the code:
> >
> > **********
> > <xsl:key name="items" match="exp:entity" use="@entity_id" />
> >
> > <xsl:template match="/">
> >   <xsl:apply-templates select="." mode="tester" />
> > </xsl:template>
> >
> > <xsl:template match="/" mode="tester">
> >   <xsl:apply-templates select="exp:transfer" mode="tester" />
> > </xsl:template>
> >
> >
> > <xsl:template match="exp:*" mode="tester">
> >   <xsl:copy>
> >     <xsl:copy-of select="@*" />
> >     <xsl:apply-templates mode="tester" />
> >   </xsl:copy>
> > </xsl:template>
> >
> >
> > <xsl:template match="exp:ref" mode="tester">
> >
> > <xsl:message>ENTER REF:<xsl:value-of select="@name"/>
> > COUNT CONSTANTS<xsl:value-of
> > select="count(parent::exp:constant/parent::exp:constants)"/>
> > COUNT SCHEMA<xsl:value-of
> > select="count(parent::exp:constant/parent::exp:constants/paren
> > t::exp:schema)"/>
> > NAME SCHEMA<xsl:value-of
> > select="ancestor::exp:schema/@schema_id"/></xsl:message>
> >
> >   <xsl:variable name="item" as="element()?"
> >     select="key('items', @name, ancestor::exp:schema)" />
> >
> >  <xsl:sequence select="$item"/>
> >
> >   <xsl:message>LEAVE REF:<xsl:value-of
> select="@name"/></xsl:message>
> > </xsl:template>
> > ********
> > Interestingly, if I comment out the xsl:sequence and the
> > xsl:message above,
> > I am able to find the lost exp:schema.  I think I will need
> > to revert back
> > to 8.6 temporarily (which behaves as desired), but I am
> interested in
> > feedback.
> >
> > Thanks,
> > Heidi
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking
> > scripting language
> > that extends applications into web and mobile media. Attend
> > the live webcast
> > and join the prime developer group breaking into this new
> > coding territory!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> > dat=121642
> > _______________________________________________
> > saxon-help mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/saxon-help
> >
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> dat=121642
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend
> the live webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> dat=121642
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: saxon-B v8.7 problem accessing ancestor nodes

Michael Kay
In reply to this post by Heidi L Preston
Thanks for helping me get to the bottom of this. I have now located the bug
and will put a patch on SourceForge as soon as I get the chance. The bug is
in the method TinyNodeImpl.isAncestorOrSelf(), which is used (only) when
calling the key() function with a third argument that is not a document
node. The bug was introduced while applying a performance improvement to
this routine.

The problem was that the method as written is updating the nodeNr property
of a node (the node used as the third argument of key()), effectively
changing this NodeInfo object to refer to a different node in the tree. The
new version of the method reads:

    public boolean isAncestorOrSelf(TinyNodeImpl d) {
        // If it's a different tree, return false
        if (tree != d.tree) return false;
        int dn = d.nodeNr;
        // If d is an attribute, then either "this" must be the same
attribute, or "this" must
        // be an ancestor-or-self of the parent of d.
        if (d instanceof TinyAttributeImpl) {
            if (this instanceof TinyAttributeImpl) {
                return nodeNr == dn;
            } else {
                dn = tree.attParent[dn];
            }
        }
        // If this is an attribute, return false (we've already handled the
case where it's the same attribute)
        if (this instanceof TinyAttributeImpl) return false;

        // From now on, we know that both "this" and "dn" are nodes in the
primary array

        // If d is later in document order, return false
        if (nodeNr > dn) return false;

        // If it's the same node, return true
        if (nodeNr == dn) return true;

        // We've dealt with the "self" case: to be an ancestor, it must be
an element or document node
        if (!(this instanceof TinyParentNodeImpl)) return false;

        // If this node is deeper than the target node then it can't be an
ancestor
        if (tree.depth[nodeNr] >= tree.depth[dn]) return false;

        // The following code will exit as soon as we find an ancestor that
has a following-sibling:
        // when that happens, we know it's an ancestor iff its
following-sibling is beyond the node we're
        // looking for. If the ancestor has no following sibling, we go up a
level.

        // The algorithm depends on the following assertion: if A is before
D in document order, then
        // either A is an ancestor of D, or some ancestor-or-self of A has a
following-sibling that
        // is before-or-equal to D in document order.

        int n = nodeNr;
        while (true) {
            int nextSib = tree.next[n];
            if (nextSib > dn) {
                return true;
            } else if (tree.depth[nextSib] == 0) {
                return true;
            } else if (nextSib < n) {
                n = nextSib;
                continue;
            } else {
                return false;
            }
        }
    }

I have added your test case to the regression test suite.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Heidi L Preston
> Sent: 15 March 2006 13:43
> To: [hidden email]
> Subject: RE: [saxon] saxon-B v8.7 problem accessing ancestor nodes
>
> Here is the xsl:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:exp="urn:iso10303-28:xslt/step/express">
>
> <xsl:strip-space elements="*"/>
>
> <xsl:output indent="yes"/>
>
> <xsl:key name="items" match="exp:entity" use="@entity_id" />
>
>
> <xsl:template match="/">
>   <xsl:apply-templates select="." mode="tester" />
> </xsl:template>
>
>
> <xsl:template match="/" mode="tester">
>   <xsl:apply-templates select="exp:transfer" mode="tester" />
> </xsl:template>
>
>
>
> <xsl:template match="exp:*" mode="tester">
>   <xsl:copy>
>     <xsl:copy-of select="@*" />
>     <xsl:apply-templates mode="tester" />
>   </xsl:copy>
> </xsl:template>
>
>
>
> <xsl:template match="exp:ref" mode="tester">
>
> <xsl:message>HERE REF:<xsl:value-of select="@name"/>
> COUNT CONSTANTS<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants)"/>
> COUNT SCHEMA<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants/paren
> t::exp:schema)"/>
> NAME SCHEMA<xsl:value-of
> select="ancestor::exp:schema/@schema_id"/></xsl:message>
>
>    <xsl:variable name="item" as="element()?"
>     select="key('items', @name, ancestor::exp:schema)" />
>
>  <xsl:sequence select="$item"/>
>
>   <xsl:message>LEAVE REF NAME:<xsl:value-of
> select="@name"/></xsl:message>
> </xsl:template>
>
>
>
> </xsl:stylesheet>
>
> My input is exactly as shown in the original E-mail (below),
> and when I run
> this in 8.7, I get the following output messages:
> ***************************************
> D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon/saxon8.jar -t
> -o saxon.out
> saxon_input.xml test.xsl
> Saxon 8.7J from Saxonica
> Java version 1.4.2_05
> Stylesheet compilation time: 661 milliseconds
> Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
> Building tree for
> file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
> class net.sf.saxon.tinytree.TinyBuilder
> Tree built in 10 milliseconds
> Tree size: 15 nodes, 40 characters, 8 attributes
> HERE REF:gri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:gri
> HERE REF:tri
> COUNT CONSTANTS1
> COUNT SCHEMA0
> NAME SCHEMA
> Error on line 41 of file:/D:/Projects/xslt2/Jeni/Temp/test.xsl:
>   XPTY0004: An empty sequence is not allowed as the third
> argument of key()
> Transformation failed: Run-time errors were reported
>
> Tool completed with exit code 2
> *******************************
>
> When I run the same stylesheet and input using v8.6.1, it runs to
> completion, finding the exp:schema:
> ********************
> D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon8.6/saxon8.jar -t -o
> saxon.out saxon_input.xml test.xsl
> Saxon 8.6.1 from Saxonica
> Java version 1.4.2_05
> Stylesheet compilation time: 651 milliseconds
> Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
> Building tree for
> file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
> class net.sf.saxon.tinytree.TinyBuilder
> Tree built in 10 milliseconds
> Tree size: 15 nodes, 40 characters, 8 attributes
> HERE REF:gri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:gri
> HERE REF:tri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:tri
> Execution time: 160 milliseconds
> Memory used: 976616
> NamePool contents: 32 entries in 32 chains. 8 prefixes, 9 URIs
>
> Tool completed successfully
> ******************************
>
> And saxon.out looks like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
>    <exp:schema schema_id="ap218_aim"
> targetNamespace="urn:iso10303-28:schema/Ap218_aim">
>       <exp:constants>
>          <exp:constant constant_id="dummy_gri">
>             <exp:entity entity_id="gri"/>
>             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
>          </exp:constant>
>          <exp:constant constant_id="dummy_tri">
>             <exp:entity entity_id="tri"/>
>             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
>          </exp:constant>
>       </exp:constants>
>       <exp:entity entity_id="tri"/>
>       <exp:entity entity_id="gri"/>
>    </exp:schema>
> </exp:transfer>
>
>
> Thanks for looking at this.
>
>
>
>
>                                                              
>              
>              "Michael Kay"                                    
>              
>              <[hidden email]                                
>              
>              m>                                              
>           To
>              Sent by:                  
> <[hidden email]>  
>              saxon-help-admin@                                
>           cc
>              lists.sourceforge                                
>              
>              .net                                            
>      Subject
>                                        RE: [saxon] saxon-B
> v8.7 problem    
>                                        accessing ancestor
> nodes            
>              03/14/2006 04:58                                
>              
>              PM                                              
>              
>                                                              
>              
>                                                              
>              
>              Please respond to                                
>              
>              saxon-help@lists.                                
>              
>               sourceforge.net                                
>              
>                                                              
>              
>                                                              
>              
>
>
>
>
> I can't reproduce your problem. I get exactly the same output
> from this
> stylesheet for Saxon 8.6.1 and Saxon 8.7.
>
> Could you please supply the full stylesheet, including the missing
> namespace
> declarations, and show the output you obtained with Saxon
> 8.6.1 and Saxon
> 8.7 respectively. Thanks.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of
> > Heidi L Preston
> > Sent: 14 March 2006 15:55
> > To: [hidden email]
> > Subject: [saxon] saxon-B v8.7 problem accessing ancestor nodes
> >
> >
> > After upgrading to v8.7 (from 8.6), I have discovered that I
> > am loosing
> > access to some ancestors from my context node.
> >
> > Input:
> > ********
> > <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
> >    <exp:schema schema_id="ap218_aim"
> > targetNamespace="urn:iso10303-28:schema/Ap218_aim">
> >       <exp:constants>
> >          <exp:constant constant_id="dummy_gri">
> >             <exp:ref name="gri"/>
> >             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
> >          </exp:constant>
> >          <exp:constant constant_id="dummy_tri">
> >             <exp:ref name="tri"/>
> >             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
> >          </exp:constant>
> >       </exp:constants>
> >       <exp:entity entity_id="tri"/>
> >       <exp:entity entity_id="gri"/>
> >    </exp:schema>
> > </exp:transfer>
> > ********
> >
> > A template is applied to each of the two occurrences of
> > exp:ref.  When I
> > get to the second occurrence, I no longer have access to my
> > ancestor::exp:schema (although I can access my
> > ancestor::exp:constants).
> > Here is the code:
> >
> > **********
> > <xsl:key name="items" match="exp:entity" use="@entity_id" />
> >
> > <xsl:template match="/">
> >   <xsl:apply-templates select="." mode="tester" />
> > </xsl:template>
> >
> > <xsl:template match="/" mode="tester">
> >   <xsl:apply-templates select="exp:transfer" mode="tester" />
> > </xsl:template>
> >
> >
> > <xsl:template match="exp:*" mode="tester">
> >   <xsl:copy>
> >     <xsl:copy-of select="@*" />
> >     <xsl:apply-templates mode="tester" />
> >   </xsl:copy>
> > </xsl:template>
> >
> >
> > <xsl:template match="exp:ref" mode="tester">
> >
> > <xsl:message>ENTER REF:<xsl:value-of select="@name"/>
> > COUNT CONSTANTS<xsl:value-of
> > select="count(parent::exp:constant/parent::exp:constants)"/>
> > COUNT SCHEMA<xsl:value-of
> > select="count(parent::exp:constant/parent::exp:constants/paren
> > t::exp:schema)"/>
> > NAME SCHEMA<xsl:value-of
> > select="ancestor::exp:schema/@schema_id"/></xsl:message>
> >
> >   <xsl:variable name="item" as="element()?"
> >     select="key('items', @name, ancestor::exp:schema)" />
> >
> >  <xsl:sequence select="$item"/>
> >
> >   <xsl:message>LEAVE REF:<xsl:value-of
> select="@name"/></xsl:message>
> > </xsl:template>
> > ********
> > Interestingly, if I comment out the xsl:sequence and the
> > xsl:message above,
> > I am able to find the lost exp:schema.  I think I will need
> > to revert back
> > to 8.6 temporarily (which behaves as desired), but I am
> interested in
> > feedback.
> >
> > Thanks,
> > Heidi
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking
> > scripting language
> > that extends applications into web and mobile media. Attend
> > the live webcast
> > and join the prime developer group breaking into this new
> > coding territory!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> > dat=121642
> > _______________________________________________
> > saxon-help mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/saxon-help
> >
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
dat=121642

> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend
> the live webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
dat=121642
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: saxon-B v8.7 problem accessing ancestor nodes

Michael Kay
In reply to this post by Heidi L Preston
Thanks for helping me get to the bottom of this. I have now located the bug
and will put a patch on SourceForge as soon as I get the chance. The bug is
in the method TinyNodeImpl.isAncestorOrSelf(), which is used (only) when
calling the key() function with a third argument that is not a document
node. The bug was introduced while applying a performance improvement to
this routine.

The problem was that the method as written is updating the nodeNr property
of a node (the node used as the third argument of key()), effectively
changing this NodeInfo object to refer to a different node in the tree. The
new version of the method reads:

    public boolean isAncestorOrSelf(TinyNodeImpl d) {
        // If it's a different tree, return false
        if (tree != d.tree) return false;
        int dn = d.nodeNr;
        // If d is an attribute, then either "this" must be the same
attribute, or "this" must
        // be an ancestor-or-self of the parent of d.
        if (d instanceof TinyAttributeImpl) {
            if (this instanceof TinyAttributeImpl) {
                return nodeNr == dn;
            } else {
                dn = tree.attParent[dn];
            }
        }
        // If this is an attribute, return false (we've already handled the
case where it's the same attribute)
        if (this instanceof TinyAttributeImpl) return false;

        // From now on, we know that both "this" and "dn" are nodes in the
primary array

        // If d is later in document order, return false
        if (nodeNr > dn) return false;

        // If it's the same node, return true
        if (nodeNr == dn) return true;

        // We've dealt with the "self" case: to be an ancestor, it must be
an element or document node
        if (!(this instanceof TinyParentNodeImpl)) return false;

        // If this node is deeper than the target node then it can't be an
ancestor
        if (tree.depth[nodeNr] >= tree.depth[dn]) return false;

        // The following code will exit as soon as we find an ancestor that
has a following-sibling:
        // when that happens, we know it's an ancestor iff its
following-sibling is beyond the node we're
        // looking for. If the ancestor has no following sibling, we go up a
level.

        // The algorithm depends on the following assertion: if A is before
D in document order, then
        // either A is an ancestor of D, or some ancestor-or-self of A has a
following-sibling that
        // is before-or-equal to D in document order.

        int n = nodeNr;
        while (true) {
            int nextSib = tree.next[n];
            if (nextSib > dn) {
                return true;
            } else if (tree.depth[nextSib] == 0) {
                return true;
            } else if (nextSib < n) {
                n = nextSib;
                continue;
            } else {
                return false;
            }
        }
    }

I have added your test case to the regression test suite.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Heidi L Preston
> Sent: 15 March 2006 13:43
> To: [hidden email]
> Subject: RE: [saxon] saxon-B v8.7 problem accessing ancestor nodes
>
> Here is the xsl:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:exp="urn:iso10303-28:xslt/step/express">
>
> <xsl:strip-space elements="*"/>
>
> <xsl:output indent="yes"/>
>
> <xsl:key name="items" match="exp:entity" use="@entity_id" />
>
>
> <xsl:template match="/">
>   <xsl:apply-templates select="." mode="tester" />
> </xsl:template>
>
>
> <xsl:template match="/" mode="tester">
>   <xsl:apply-templates select="exp:transfer" mode="tester" />
> </xsl:template>
>
>
>
> <xsl:template match="exp:*" mode="tester">
>   <xsl:copy>
>     <xsl:copy-of select="@*" />
>     <xsl:apply-templates mode="tester" />
>   </xsl:copy>
> </xsl:template>
>
>
>
> <xsl:template match="exp:ref" mode="tester">
>
> <xsl:message>HERE REF:<xsl:value-of select="@name"/>
> COUNT CONSTANTS<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants)"/>
> COUNT SCHEMA<xsl:value-of
> select="count(parent::exp:constant/parent::exp:constants/paren
> t::exp:schema)"/>
> NAME SCHEMA<xsl:value-of
> select="ancestor::exp:schema/@schema_id"/></xsl:message>
>
>    <xsl:variable name="item" as="element()?"
>     select="key('items', @name, ancestor::exp:schema)" />
>
>  <xsl:sequence select="$item"/>
>
>   <xsl:message>LEAVE REF NAME:<xsl:value-of
> select="@name"/></xsl:message>
> </xsl:template>
>
>
>
> </xsl:stylesheet>
>
> My input is exactly as shown in the original E-mail (below),
> and when I run
> this in 8.7, I get the following output messages:
> ***************************************
> D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon/saxon8.jar -t
> -o saxon.out
> saxon_input.xml test.xsl
> Saxon 8.7J from Saxonica
> Java version 1.4.2_05
> Stylesheet compilation time: 661 milliseconds
> Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
> Building tree for
> file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
> class net.sf.saxon.tinytree.TinyBuilder
> Tree built in 10 milliseconds
> Tree size: 15 nodes, 40 characters, 8 attributes
> HERE REF:gri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:gri
> HERE REF:tri
> COUNT CONSTANTS1
> COUNT SCHEMA0
> NAME SCHEMA
> Error on line 41 of file:/D:/Projects/xslt2/Jeni/Temp/test.xsl:
>   XPTY0004: An empty sequence is not allowed as the third
> argument of key()
> Transformation failed: Run-time errors were reported
>
> Tool completed with exit code 2
> *******************************
>
> When I run the same stylesheet and input using v8.6.1, it runs to
> completion, finding the exp:schema:
> ********************
> D:\Projects\xslt2\Jeni\Temp>java -jar D:/saxon8.6/saxon8.jar -t -o
> saxon.out saxon_input.xml test.xsl
> Saxon 8.6.1 from Saxonica
> Java version 1.4.2_05
> Stylesheet compilation time: 651 milliseconds
> Processing file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml
> Building tree for
> file:/D:/Projects/xslt2/Jeni/Temp/saxon_input.xml using
> class net.sf.saxon.tinytree.TinyBuilder
> Tree built in 10 milliseconds
> Tree size: 15 nodes, 40 characters, 8 attributes
> HERE REF:gri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:gri
> HERE REF:tri
> COUNT CONSTANTS1
> COUNT SCHEMA1
> NAME SCHEMAap218_aim
> LEAVE REF NAME:tri
> Execution time: 160 milliseconds
> Memory used: 976616
> NamePool contents: 32 entries in 32 chains. 8 prefixes, 9 URIs
>
> Tool completed successfully
> ******************************
>
> And saxon.out looks like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
>    <exp:schema schema_id="ap218_aim"
> targetNamespace="urn:iso10303-28:schema/Ap218_aim">
>       <exp:constants>
>          <exp:constant constant_id="dummy_gri">
>             <exp:entity entity_id="gri"/>
>             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
>          </exp:constant>
>          <exp:constant constant_id="dummy_tri">
>             <exp:entity entity_id="tri"/>
>             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
>          </exp:constant>
>       </exp:constants>
>       <exp:entity entity_id="tri"/>
>       <exp:entity entity_id="gri"/>
>    </exp:schema>
> </exp:transfer>
>
>
> Thanks for looking at this.
>
>
>
>
>                                                              
>              
>              "Michael Kay"                                    
>              
>              <[hidden email]                                
>              
>              m>                                              
>           To
>              Sent by:                  
> <[hidden email]>  
>              saxon-help-admin@                                
>           cc
>              lists.sourceforge                                
>              
>              .net                                            
>      Subject
>                                        RE: [saxon] saxon-B
> v8.7 problem    
>                                        accessing ancestor
> nodes            
>              03/14/2006 04:58                                
>              
>              PM                                              
>              
>                                                              
>              
>                                                              
>              
>              Please respond to                                
>              
>              saxon-help@lists.                                
>              
>               sourceforge.net                                
>              
>                                                              
>              
>                                                              
>              
>
>
>
>
> I can't reproduce your problem. I get exactly the same output
> from this
> stylesheet for Saxon 8.6.1 and Saxon 8.7.
>
> Could you please supply the full stylesheet, including the missing
> namespace
> declarations, and show the output you obtained with Saxon
> 8.6.1 and Saxon
> 8.7 respectively. Thanks.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of
> > Heidi L Preston
> > Sent: 14 March 2006 15:55
> > To: [hidden email]
> > Subject: [saxon] saxon-B v8.7 problem accessing ancestor nodes
> >
> >
> > After upgrading to v8.7 (from 8.6), I have discovered that I
> > am loosing
> > access to some ancestors from my context node.
> >
> > Input:
> > ********
> > <exp:transfer xmlns:exp="urn:iso10303-28:xslt/step/express">
> >    <exp:schema schema_id="ap218_aim"
> > targetNamespace="urn:iso10303-28:schema/Ap218_aim">
> >       <exp:constants>
> >          <exp:constant constant_id="dummy_gri">
> >             <exp:ref name="gri"/>
> >             <exp:expression>ri ( '' ) || gri ( )</exp:expression>
> >          </exp:constant>
> >          <exp:constant constant_id="dummy_tri">
> >             <exp:ref name="tri"/>
> >             <exp:expression>ri ( '' ) || tri ( )</exp:expression>
> >          </exp:constant>
> >       </exp:constants>
> >       <exp:entity entity_id="tri"/>
> >       <exp:entity entity_id="gri"/>
> >    </exp:schema>
> > </exp:transfer>
> > ********
> >
> > A template is applied to each of the two occurrences of
> > exp:ref.  When I
> > get to the second occurrence, I no longer have access to my
> > ancestor::exp:schema (although I can access my
> > ancestor::exp:constants).
> > Here is the code:
> >
> > **********
> > <xsl:key name="items" match="exp:entity" use="@entity_id" />
> >
> > <xsl:template match="/">
> >   <xsl:apply-templates select="." mode="tester" />
> > </xsl:template>
> >
> > <xsl:template match="/" mode="tester">
> >   <xsl:apply-templates select="exp:transfer" mode="tester" />
> > </xsl:template>
> >
> >
> > <xsl:template match="exp:*" mode="tester">
> >   <xsl:copy>
> >     <xsl:copy-of select="@*" />
> >     <xsl:apply-templates mode="tester" />
> >   </xsl:copy>
> > </xsl:template>
> >
> >
> > <xsl:template match="exp:ref" mode="tester">
> >
> > <xsl:message>ENTER REF:<xsl:value-of select="@name"/>
> > COUNT CONSTANTS<xsl:value-of
> > select="count(parent::exp:constant/parent::exp:constants)"/>
> > COUNT SCHEMA<xsl:value-of
> > select="count(parent::exp:constant/parent::exp:constants/paren
> > t::exp:schema)"/>
> > NAME SCHEMA<xsl:value-of
> > select="ancestor::exp:schema/@schema_id"/></xsl:message>
> >
> >   <xsl:variable name="item" as="element()?"
> >     select="key('items', @name, ancestor::exp:schema)" />
> >
> >  <xsl:sequence select="$item"/>
> >
> >   <xsl:message>LEAVE REF:<xsl:value-of
> select="@name"/></xsl:message>
> > </xsl:template>
> > ********
> > Interestingly, if I comment out the xsl:sequence and the
> > xsl:message above,
> > I am able to find the lost exp:schema.  I think I will need
> > to revert back
> > to 8.6 temporarily (which behaves as desired), but I am
> interested in
> > feedback.
> >
> > Thanks,
> > Heidi
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking
> > scripting language
> > that extends applications into web and mobile media. Attend
> > the live webcast
> > and join the prime developer group breaking into this new
> > coding territory!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> > dat=121642
> > _______________________________________________
> > saxon-help mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/saxon-help
> >
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
dat=121642

> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend
> the live webcast
> and join the prime developer group breaking into this new
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
dat=121642
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help