Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2008, 04:55 AM
Registered User
 
Join Date: Sep 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use of xsl:key problem in xslt 2

Hello,

I am getting a problem in using xsl:key in xslt2. I am trying to group the nodes.
I am using nxslt2 for transformation. When i was using nxslt (version 1.1), then the keys were working fine means the nodes are grouped, but as soon as i shifted to nxslt2, the grouping fails.

Can anybody tell me the cause.
Below is the xml ans xslt
XML:-

<Abd>
 <AbdUid>
   <AseUid>
      <codeType>FIR</codeType>
      <codeId>AMSWELL</codeId>
   </AseUid>
  </AbdUid>
</Abd>
<IAS_Avx>
  <IAS_AvxUid>
    <AbdUid>
      <AseUid>
    <codeType>FIR</codeType>
    <codeId>AMSWELL</codeId>
      </AseUid>
    </AbdUid>
    <noSeq>1</noSeq>
  </IAS_AvxUid>
  <codeType>GRC</codeType>
  <geoLat>570500.0000N</geoLat>
  <geoLong>0400000.0000W</geoLong>
  <codeDatum>WGE</codeDatum>
</IAS_Avx>

XSLT:

<xsl:template match="Abd">
  <xsl:variable name="Codeuid" select="codeType"/> <xsl:variable name="uid" select="AbdUid"/>
   <xsl:for-each select="AbdUid[ count(. | key('AbdCode_key',$uid)[1]) = 1]">
   <Abd>
     <xsl:copy-of select="$uid"/>
     <xsl:for-each select="key('Abd_key',$uid)">
    <xsl:if test="codeType != 'CIR'">
      <Avx>
        <xsl:copy-of select="."/>
          </Avx>
    </xsl:if>
     </xsl:for-each>
   </Abd>
</xsl:template>

Please tell me is there any change in using xslt2

 
Old September 2nd, 2008, 05:13 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

nxsl2 is NOT XSLT 2.0, it is XSLT 1.0 - for .Net 2.0 - that is a big difference.

When you say 'the grouping fails' what do you mean? Do you get an output? An error? What?

You have only shown us (I assume) a small part of your XSLT - as I do not see the xsl:key statements?

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
<xsl:key elayaraja.s XSLT 1 July 23rd, 2008 05:00 AM
using 3 XPaths to index using xsl:key Chamkaur XSLT 3 March 2nd, 2007 04:09 AM
Using key() and <xsl:key> freddy XSLT 2 January 18th, 2007 08:55 PM
xsl:key doesnt work cristtiah XSLT 11 May 24th, 2006 09:57 AM
selection within xsl:key Kabe XSLT 4 February 25th, 2005 05:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.