xsl-list
[Top] [All Lists]

RE: 2 values for an attribute?

2003-08-13 00:01:46

Is it possible for a single element to have two values for 
one attribute? 

No.

For example (two total guesses for <e>)

<x>
      <e value="1|2">Some text</e>
      <e value="1" value="2">Some text</e>
</x>

In your first example the attribute has a single value, "1|2". You can
interpret that value any way you like. If you want the value of the
attribute to be a list then it's more common (and supported by XML
Schema) to use a space as the separator.

Or is the only solution to double up on data like this (as 
one example)

<x>
      <e value="1">Some text</e>
      <e value="2">Some text</e>
</x>

Holding data redundantly is a bad idea. A much better solution is to
switch from using attributes to using child elements.

I can't quite see what this has to do with XSLT?

Michael Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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