[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] 2 values for an attribute?


Subject: Re: [xsl] 2 values for an attribute?
From: Armen Martirossian <armmarti@xxxxxxxxx>
Date: Wed, 13 Aug 2003 00:00:34 -0700 (PDT)

--- Tig <tigger@xxxxxxxxxxxxxxxxx> 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



Current Thread