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

Re: query

Subject: Re: query
From: Jarkko.Moilanen@xxxxxx
Date: Sat, 8 Mar 2003 10:42:41 +0200
1
Lainaus "Koes, Derrick" <Derrick.Koes@xxxxxxxxxxxxxxxx>:

| 
| I'm looking for an xpath query to get me the template node with the
| largest
| version number from the largest subset of templates with the same id.


XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-1" indent="yes" /> 
	
<xsl:template match="Templates">

 <xsl:for-each select="Template">	
 <xsl:sort select="@version"/>
 <xsl:sort select="@id"/> 
	<xsl:if test="position()=last()">
	 <xsl:copy-of select="."/>
	</xsl:if>
 </xsl:for-each>
 </xsl:template>

</xsl:stylesheet> 

RESULT TREE:
<?xml version="1.0" encoding="iso-8859-1"?>
<Template id="2" version="1"/>


Cheers, 
Jarkko.

| 
| The XML looks like:
| 
| <Template id="1" version="0"/>
| <Template id="2" version="0"/>
| <Template id="3" version="0"/>
| <Template id="2" version="1"/>
| 
| In the above XML, the answer to my query would be <Template id="2"
| version="1"/>
| 
| Any help is appreciated.
| 
| Thanks,
| Derrick
| 
| 
| 
| 
| This electronic transmission is strictly confidential to Smith & Nephew
| and
| intended solely for the addressee.  It may contain information which is
| covered by legal, professional or other privilege.  If you are not the
| intended addressee, or someone authorized by the intended addressee to
| receive transmissions on behalf of the addressee, you must not retain,
| disclose in any form, copy or take any action in reliance on this
| transmission.  If you have received this transmission in error, please
| notify the sender as soon as possible and destroy this message.
| 
|  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| 
| 


***************************************************
* Jarkko Moilanen                                 *
* Project Researcher, ITCM (www.itcm.org)         *
* Profound XML technology Expert                  *
* University of Tampere                           *
* Hypermedia Laboratory                           *
***************************************************

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


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.