Subject: RE: Plural attribute values versus a separate element.
From: Ed Blachman <EdB@xxxxxxxxxxx>
Date: Fri, 23 Aug 2002 12:25:23 -0400
|
> -----Original Message-----
> From: Edward L. Knoll [mailto:ed.knoll@xxxxxxxxxxxxxx]
> Sent: Friday, August 23, 2002 11:35 AM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Plural attribute values versus a separate element.
>
> I have a element which may be plural. Every
> instance of that element share a common "type" attribute, but the "type"
> values can be plural. Well formed XML requires attributes to be unique
> for a specific element instance.
>
> I suspect that I should turn this attribute into a peer element. Does
> anyone have insight into this problem?
Seems to me that your best bet would be to use child elements, not peer
elements.
That is: if in your Approach A you might see
<element type="A,B">...</element>
<element type="A,C,X">...</element>
you could instead use a child element
<element>
<type>A</type>
<type>B</type>
...
</element>
<element>
<type>A</type>
<type>C</type>
<type>X</type>
...
</element>
You get the multiplicity you want in a manner that's amenable to XPath
querying without having to resort to string manipulation.
Ed Blachman
Trellix Corporation
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|