xsl-list
[Top] [All Lists]

Re: 2 values for an attribute?

2003-08-13 00:00:34

--- Tig <tigger(_at_)onemoremonkey(_dot_)com> wrote:
Is it possible for a single element to have two
values for one
attribute? For example (two total guesses for <e>)

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


You can't have two attributes with the same name.

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>


It's not the only possible solution of course: if you
restricted to have just one attribute named "value"
for element "e", then probably the only solution is
which you suggested; if not, you can write:

<x>
  <e value1="1" value2="2">Some text</e>
</x>

Then you can access the attributes this way:

<xsl:template match="e">
  <xsl:for-each select="@*[substring(local-name(), 1,
5) = 'value']">

</xsl:template>



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



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



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