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

Re: XML tags as map keys and impact on XSLT/XPath

Subject: Re: XML tags as map keys and impact on XSLT/XPath
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 21 Jun 2010 12:19:39 -0400
Re:  XML tags as map keys and impact on XSLT/XPath
Hi,

At 06:14 AM 6/18/2010, Mike wrote:
On 18/06/2010 07:28, Wolfgang Laun wrote:
Every now and then, people (not me) want to represent a Map<K,V> in XML by using
s.th. like
<map>
<k1>v1</k1>
<k2>v2</k2>
...
</map>
with ki from K and vi from V. Apart from the obvious limitation for K's values, I feel that this is somehow violating the spirit of XML....

I agree: in general it's a poor way of using XML, and it makes it more difficult to process using XSLT.

I agree with everything said in this thread so far (including Mike's analysis of where the system-level problems are in naming elements after values), but I hasten to add that the problems suggested for the XSLT may be overstated, at least if you allow for a little creativity:


<xsl:key name="value-by-key" match="map/*" use="local-name()"/>

While I wouldn't recommend this, I don't see it as entirely illegitimate either, especially if you allow that the format Wolfgang offers has a kind of bizarre elegance for the non-XML savvy user. Which is arguable, I know. :-)

And sometimes it's the job of implementors to indulge the whims of designers.

That being said, I'd probably go with a variant of Andrew's suggestion:

<entry key="k1">v1</entry>
<entry key="k2">v2</entry>
<entry key="k3">v3</entry>

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.