RE: [xsl] Saxon Quirk

Subject: RE: [xsl] Saxon Quirk
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 15 Feb 2001 18:14:33 -0000
> I posted this on the Saxon list yesterday, but then I started 
> to think that
> there might be a better way to generate the list that I 
> wanted. Any thoughts
> would be greatly appreciated.

Well of course if you want a Saxon solution, you could write

<xsl:variable name="allpubs" 
  select="saxon:distinct(/publist/pubtag[@list='yes']/@pub)"/>

Mike Kay

> 
> Regards,
> Kurt
> ---
> I've been using Instant Saxon 6.2 to try to generate a list 
> based on two
> attributes of a tag as given by the allpubs variable below. I've been
> questioning the validity of my XSL, but I get the expected 
> output in MSXML3
> and Xalan2.0.0 (although Xalan1.0.2 was broken). 
> 
> <!-- allpubs.xsl -->
> <xsl:stylesheet version="1.1"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:variable name="allpubs"
> select="//pubtag[@list='yes']/@pub[not(.=preceding::pubtag[@li
> st='yes']/@pub
> )]" />
> <xsl:template match="/">
> 	<xsl:for-each select="$allpubs">
> 		<xsl:value-of select="." /><br />
> 	</xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> 
> <!-- allpubs.xml -->
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" href="allpubs.xsl"?>
> <publist>
> 	<pubtag list='yes' pub='xml journal' />
> 	<pubtag list='no'  pub='fortran journal' />
> 	<pubtag list='yes' pub='xml journal' />
> 	<pubtag list='yes' pub='xsl journal' />
> 	<pubtag list='yes' pub='css journal' />
> 	<pubtag list='yes' pub='xml journal' />
> 	<pubtag list='no'  pub='cobol journal' />
> 	<pubtag list='no'  pub='ada journal' />
> 	<pubtag list='no'  pub='fortran journal' />
> 	<pubtag list='no'  pub='snobol journal' />
> 	<pubtag list='yes' pub='xsl journal' />
> </publist>
> 
> <!-- Expected Output -->
> xml journal
> xsl journal
> css journal
> 
> <!-- Instant Saxon 6.2 Output -->
> xml journal
> xml journal
> xsl journal
> css journal
> xml journal
> xsl journal
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread