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

Re: problems with xslt on "open" catalog-formats like

Subject: Re: problems with xslt on "open" catalog-formats like ecXMLoder xCBL
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 28 Apr 2003 18:12:36 +0200
xslt normalize space
Hayk, Matthias wrote:
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.

You could use a key :-) <xsl:key name="items-by-length" match="ITEM" use="KEYVALUE[KEY='length']/VALUE"/>

Use as
 <xsl:for-each select="key('items-by-length','100')>
   <xsl:value-of select="KEYVALUE[KEY='price']/VALUE"/>
 </xsl:for-each>

Note that the above will not work on the XML you supplied with
the mail because of the whitespace surrounding all values.
		<KEY>
			Suplier Name
		</KEY>

I hope your original XML is more like <KEYVALUE> <KEY>Suplier Number</KEY> <VALUE>123</VALUE> </KEYVALUE>


If not, you'll have to use normalize-space() a lot: <xsl:key name="items-by-length" match="ITEM" use="normalize-space(KEYVALUE[normalize-space(KEY)='length']/VALUE)"/> ... <xsl:for-each select="key('items-by-length','100')> <xsl:value-of select="normalize-space(KEYVALUE[ normalize-space(KEY)='price']/VALUE)"/> </xsl:for-each>

Note that normalize-space may have the unwanted side effect of
normalizing spaces within keys and values too.

J.Pietschmann


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.