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

problems with xslt on "open" catalog-formats like ecXM

Subject: problems with xslt on "open" catalog-formats like ecXML oder xCBL
From: "Hayk, Matthias" <Matthias.Hayk@xxxxxxxxxx>
Date: Mon, 28 Apr 2003 14:19:31 +0200
ecxml
Hello,

I am dealing with a product catalog delivered in the xml-standard ecXML 3.0
from Requisite. From this product catalog i want to create a dynamic
web-navigation with to select our different products with a web-client.
One specific item on that xml-format is, that using that xml-format you can
design your own structure for your catalog. to achieve this, the attributes
for a product are not fix xml-elements, which are declared in a dtd or
schema-file. all "own" attributes are stored in key/value elements to a
product.

for example

<!-- A new Product comes with an ITEM-Element-Tag and the action attribute
holds the action to do for that product -->
<ITEM action = "ADD">
	<KEYVALUE>
		<KEY>
			Suplier Name
		</KEY>
		<VALUE>
			abc enterprises
		</VALUE>
	</KEYVALUE>
	<KEYVALUE>
		<KEY>
			Suplier Number
		</KEY>
		<VALUE>
			123
		</VALUE>
	</KEYVALUE>
	<KEYVALUE>
		<KEY>
			PartNum
		</KEY>
		<VALUE>
			4711
		</VALUE>
	</KEYVALUE>
	<KEYVALUE>
		<KEY>
			length
		</KEY>
		<VALUE>
			100
		</VALUE>
	</KEYVALUE>
	<KEYVALUE>
		<KEY>
			price
		</KEY>
		<VALUE>
			123.45
		</VALUE>
	</KEYVALUE>

This brings some difficulties when making a selection on the product catalog
with xslt
When i want to get the prices for all products with a length of 100 i CAN'T
make an XPATH /XLST like this

	<xsl:for-each select="//ITEM[length=100]">
		the price for <xsl:value-of select="partnum"/> is
<xsl:value-of select="price"/>
	<xsl:for-each>

because there are not length-attribute and partnum or price elements. 

my actual way is:

	<xsl:for-each
select="//ITEM/KEYVALUE/KEY[text()='length']/following-sibling::*[text()='10
0']/../..">
		the price for <xsl:value-of
select="KEYVALUE/KEY[text()='partnum']/following-sibling::*"/> is
<xsl:value-of select="KEYVALUE/KEY[text()='price']/following-sibling::*"/>
	<xsl:for-each>

MY QUESTIONS now are:

a) is there a more elegant way to select product-items based on the values
of specific product-attributes defined in the KEYVALUE/KEY and
KEYVALUE/VALUE strucutres. it works but gets more complex when there is more
than one search-condition for the selection

b) i want to sort the product-items in that for-loop based on the values. So
i want to sort the products with length of 100 on their price-value.
I didn't found a working <xsl:sort> selection for it.

regards
matthias hayk





 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.