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

Selecting /getting only one node value out of the many

Subject: Selecting /getting only one node value out of the many identical values
From: "Tapan Nanawati" <tapan_nanawati@xxxxxxxxx>
Date: Fri, 2 Mar 2001 02:08:17 +0530
xslt to find smallest value
I am  not sure if this is basic question but even a hint in the form of
statement  / query may be of help.

I have an XML like this


<?xml version="1.0" encoding="UTF-8"?>
<clothes>
<category name="shirts">
	<sno times="1">
		<brand>Arrow</brand>
		<size>X-L</size>
		<color>red</color>	</sno>

	<sno times="2">
		<brand>Arrow</brand>
		<size>Med</size>
		<color>blue</color>	</sno>

	<sno times="3">
		<brand>Arrow</brand>
		<size>L</size>
		<color>red</color>	</sno>

	<sno times="4">
		<brand>Lee</brand>
		<size>X-L</size>
		<color>green</color>	</sno>
</category>
</clothes>

this XML is genereted based on query from a user and comes from a database.
I want to display to the user only  the available "brands"  of shirts
Ie. output shall be only
"Arrow" and "Lee" in my case. and the user can then  further query on the
subitems like "size" and "color". SO I want a
< Select "brand"  from "clothes/category/sno" where "there is no repetiion"
>  (:-)
sort of query. I hope I could make myself clear.
what XSL query can I write for this!
Thanks for the attenttion


Tapan Nanawati
tapan_nanawati@xxxxxxxxx
91-11-6685274 (o)
91-98112-98982 (m)
New Delhi - INDIA
------------------------------
God is real, unless declared integer.


$-----Original Message-----
$From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
$[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Zeynep Gunal
$Sent: Thursday, March 01, 2001 10:44 PM
$To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
$Subject:  selecting only one among many matching nodes..
$
$
$Hi,
$
$I have an XML that looks like this (I simplified the real one):
$
$<AAA>
$   <code>123</code>
$   <BBB>
$      <str1>abc</str1>
$      <str2>def</str2>
$      <str3>ghi</str3>
$   <BBB>
$   <CCC>
$      <type>1</type>
$      <code>123</code>
$      <ret>5</ret>
$      <DDD>
$         <str1>abc</str1>
$         <str2>def</str2>
$         <str3>ghi</str3>
$      </DDD>
$   </CCC>
$   <CCC>
$      <type>3</type>
$      <code>123</code>
$      <ret>3</ret>
$      <DDD>
$         <str1>abc</str1>
$         <str2>def</str2>
$         <str3>ghi</str3>
$      </DDD>
$   </CCC>
$   <CCC>
$      <type>2</type>
$      <code>123</code>
$      <ret>1</ret>
$      <DDD>
$         <str1>ABC</str1>
$         <str2>DEF</str2>
$         <str3>GHI</str3>
$      </DDD>
$   </CCC>
$   <CCC>
$      <type>0</type>
$      <code>123</code>
$      <ret>4</ret>
$      <DDD>
$         <str1>abc</str1>
$         <str2>def</str2>
$         <str3>ghi</str3>
$      </DDD>
$   </CCC>
$</AAA>
$
$I need to find the smallest 'ret' value where:
$
$AAA/code = AAA/CCC/code         and
$AAA/BBB/str1 = AAA/CCC/DDD/str1 and
$AAA/BBB/str2 = AAA/CCC/DDD/str2 and
$AAA/BBB/str3 = AAA/CCC/DDD/str3
$
$which is here 3.
$
$I am using XSLT, and I have been struggling for hours now, I searched the
$archives, I found one similar question, but no answer and I could
$not find a
$solution myself either. The only way I can think of doing it is using
$something like do-while, but such an element/function is not supported by
$XSLT.
$
$Is there a solution?
$
$Thanks in advance,
$
$Zeynep
$
$ 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

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.