Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] problem using last() within

From: Matt Heckel <matt_heckel@--------->
To:
Date: 4/1/2005 10:27:00 AM
Once again, my intuition has failed me and I need
help. I was trying to find the last item within the
last group of a data population and I've run into some
interesting (ie. frustrating) behavior. For the
record, I'm using SAXON8b to process an XSLT V. 2.0
stylesheet.

As I mentioned, I'm grouping using for-each-group and
then iterating through each group using for-each on
the current-group(). While using for-each through the
current-group()using everything seems to be working
just fine. That is, the position() value is sequential
and last() returns the total iterations for the
current-group(). However, in the outer
for-each-group(ing) the last() function doesn't seem
to be returning the right value. Since both for-each
and for-each-group change the context when invoked, it
seems they should both behave the same way?  Also, I
was playing with the current() function and it doesn't
seem to evaluate at all. This is of lesser importance
to me for this particular problem I'm facing but
thought I would ask for future reference. Thanks VERY
much. My source doc and stylesheet are as follows.  

<CASTDataset>
<ETL_AIR_7 ACFT_TYP_SYN_NM="E-2"
CARRIER_NM="Constellation"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="EA-18G"
CARRIER_NM="Constellation"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="F-18C"
CARRIER_NM="Constellation"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="F-18E"
CARRIER_NM="Constellation"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="E-2"
CARRIER_NM="Eisenhower"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="EA-18G"
CARRIER_NM="Eisenhower"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="F-18C"
CARRIER_NM="Eisenhower"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="F-18E"
CARRIER_NM="Eisenhower"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="E-2"
CARRIER_NM="Enterprise"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="EA-18G"
CARRIER_NM="Enterprise"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="F-18C"
CARRIER_NM="Enterprise"/>
<ETL_AIR_7 ACFT_TYP_SYN_NM="F-18E"
CARRIER_NM="Enterprise"/>
</CASTDataset>

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2004/10/xpath-functions"
xmlns:xdt="http://www.w3.org/2004/10/xpath-datatypes">

<xsl:output method="text" version="1.0"
encoding="UTF-8" indent="yes"
omit-xml-declaration="yes"/>

<xsl:variable name="endline" select="'&#x0ax;'"/>
<xsl:template match="/">
<xsl:for-each-group select="CASTDataset/ETL_AIR_7"
group-by="@CARRIER_NM">
<xsl:value-of select="concat('The current node is ',
current())"/>
<xsl:value-of select="$endline"/>
<xsl:value-of
select="concat(' For the ', @CARRIER_NM, ' group, the
current position is ', position(), ' and last is ',
last())"/>
<xsl:value-of select="$endline"/>
<xsl:for-each select="current-group()">
<xsl:value-of select="concat('For the items within the
current-group(), ACFT_TYP_SYN_NM is ',
@ACFT_TYP_SYN_NM, ',the current position is ',
position(), ' and last is ', last())"/>
<xsl:value-of select="$endline"/>
</xsl:for-each>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>




		
__________________________________ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent