RE: [xml-dev] [newbie] Mapping a Map 101?

From
Michael Kay <>
To
'PA' <>,
Date
2004-12-13T14:11:06
ID
<>
Thread
RE: [xml-dev] [newbie] Mapping a Map 101?
> > I wouldn't rely on sibling relationships.
> 
> Ok. Why would relying on such relationships be a "bad" thing though? 
> What are the benefits of introducing an <entry> tag in the <dict> 
> structure?

It makes the processing code much more clear.

Compare

<xsl:value-of select="entry[key=$p]/value"/>

To

<xsl:value-of select="key[.=$p]/following-sibling::*[1]"/>

It's also more extensible.

If you use an XQuery implementation that doesn't support the sibling axes,
then the version that relies on sibling relationships is going to be really
hard work to process. (Some XQuery vendors have been very resistant to
providing the sibling and ancestor axes.)

Michael Kay
http://www.saxonica.com/