[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:key containing mixed elements

Subject: RE: xsl:key containing mixed elements
From: George James <GeorgeJ@xxxxxxxxxxxxxxx>
Date: Mon, 25 Oct 2004 19:07:25 +0100
xsl key duplicate
Just, for the record, Apache seemed to have moved from bugzilla to JIRA, so
this bug is now submitted here:
http://issues.apache.org/jira/browse/XALANJ-1981


Michael
Thank you for confirming that it works in other xsl processors.

For the record I've submitted this as a xalan bug:
http://issues.apache.org/bugzilla/show_bug.cgi?id=31868

Regards
George

George James Software
Cachi Tools, Training, Technology
www.georgejames.com
+44-1932-252568



> -----Original Message-----
> From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> Sent: 23 October 2004 16:28
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  xsl:key containing mixed elements
>
>
> Your code works fine in Saxon. It reports:
>
> Duplicate state name: standby
> Duplicate state name: record
> Duplicate state name: record
> Duplicate state name: off
> Duplicate state name: off
> Duplicate state name: standby
>
> Michael Kay
> http://www.saxonica.com/
>
>
> > -----Original Message-----
> > From: George James [mailto:GeorgeJ@xxxxxxxxxxxxxxx]
> > Sent: 23 October 2004 13:10
> > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> > Subject:  xsl:key containing mixed elements
> >
> > Hi
> >
> > I have a problem that I'm trying to solve using <xsl:key>
> but I'm not
> > getting the results that I expected.
> >
> > It's probably best to explain first what I want to do and then show
> > how I tried to use <xsl:key> to solve the problem.
> >
> > I have a file containing a mixture of <UML:SimpleState> and
> > <UML:CompositeState> elements.  Each one has a name
> attribute, but in
> > the case of the <UML:CompositeState> element the name comprises of a
> > state name followed by a colon followed by a sub-machine state name.
> >
> > What I want to do is simply read my file and report any duplicate
> > state names.
> >
> > So, here's a simplified example of some of the data in my file:
> >
> > <UML:SimpleState name="on" />
> > <UML:SimpleState name="off" />
> > <UML:SimpleState name="off" />
> > <UML:SimpleState name="standby" />
> > <UML:CompositeState name="rewind:rewinding" /> <UML:CompositeState
> > name="forward:fastforwarding" /> <UML:CompositeState
> > name="standby:waiting" /> <UML:CompositeState
> name="record:recording"
> > /> <UML:CompositeState name="record:recording" />
> >
> > I'd like to generate error messages for states 'off', 'standby' and
> > 'record' because they are duplicates.
> >
> > This is how I tried to solve the problem.  It works for the 'off'
> > case but not for the 'standby' or the 'record' cases:
> >
> >  <!-- Create an index containing the name of all simple states
> >       and the first part of the name of all composite states -->
> > <xsl:key
> >   name="name"
> >   match="UML:CompositeState[@name]"
> >   use="substring-before(@name,':')" />
> >  <xsl:key
> >   name="name"
> >   match="UML:SimpleState[@name]"
> >   use="@name" />
> >
> >   <xsl:template match='/'>
> >     <xsl:for-each select="//UML:CompositeState[@name]">
> >       <xsl:variable name='name'
> select="substring-before(@name,':')"/>
> > 	    <xsl:if test="count(key('name',$name))>1">
> > 	      <xsl:message>Duplicate state name: <xsl:value-of
> > select='$name'/></xsl:message>
> > 	    </xsl:if>
> >     </xsl:for-each>
> >
> >     <xsl:for-each select="//UML:SimpleState[@name]">
> >       <xsl:variable name='name' select="@name"/>
> > 	    <xsl:if test="count(key('name',$name))>1">
> > 	      <xsl:message>Duplicate state name: <xsl:value-of
> > select='$name'/></xsl:message>
> > 	    </xsl:if>
> >     </xsl:for-each>
> >   </xsl:template>
> >
> > Can anyone enlighten me please?
> >
> > BTW I'm using xalan:
> > Vendor: Apache Software Foundation
> > Vendor URL: http://xml.apache.org/xalan-j
> >
> > D:\s>java -version
> > java version "1.4.2_05"
> > Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.4.2_05-b04)
> > Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
> >
> >
> > Regards
> > George
> >
> > George James Software
> > Cachi Tools, Training, Technology
> > www.georgejames.com
> > +44-1932-252568

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.