xsl-list
[Top] [All Lists]

Re: [xsl] Xpath Syntax Issue

2012-07-23 17:36:12


Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:


On 23/06/2012 22:05, G. Ken Holman wrote:
At 2012-06-23 16:40 -0400, John A. Walsh wrote:
This seems to work:

<xsl:template match="pets/animal[species[normalize-space(.) = 
'fish']]"/>

Which would be the same as:

  <xsl:template match="pets/animal[normalize-space(species) =
'fish']"/>

... which might be easier for someone maintaining the stylesheet to 
understand.

Of course the processor may optimize both expressions to be the same 
executing code, but from a maintenance perspective, keeping 
expressions simpler would have more benefit.


But the two aren't equivalent if an animal element has more than one 
species child. If that's the case, the first expression works and the 
second one doesn't.

I don't know if an animal can be both flesh and fowl,  so to speak. Perhaps 
during a reclassification more radical than the poor old fruit fly underwent 
recently. 

If not,  I would argue that this makes a good example of choosing between 
character data and attribute. Possibly with a maintained authority list for ID 
values for species and other taxonomical data (which would allow multiple 
values as IDREFS). I just have this old-fashioned gut reaction that reference 
data (if this is that) should be as robust as possible. 

///Peter 
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>