You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Roland <ro...@netquant.com.br> on 2002/04/17 00:23:59 UTC

eating attribute values

Hello

I noticed a strange behaviour when using it for the following:

In my XML file I have this line:
<option selected="selected">False</option>

In my XSL file I want to copy that node with:
<xsl:copy-of select="./option"/>

If I do that the result will be:

<option selected>False</option>

The attribute value has dissappeared!
Note that this doesn't happen if the attribute value is DIFFERENT than the 
attribute name. For example with

<option selected="Blue">False</option>

It will work as expected.
Is this a bug or default behaviour that I don't know about?

Best regards,
Roland


RE: eating attribute values

Posted by Roland <ro...@netquant.com.br>.
At 03:50 PM 4/16/02 -0700, Gary L Peskin wrote:
>See http://www.w3.org/TR/xslt#section-HTML-Output-Method
>
>"The html output method should output boolean attributes (that is
>attributes with only a single allowed value that is equal to the name of
>the attribute) in minimized form. For example, a start-tag written in
>the stylesheet as
>
><OPTION selected="selected">
>should be output as
>
><OPTION selected>"

Thanks a lot for the help!


RE: eating attribute values

Posted by Gary L Peskin <ga...@firstech.com>.
See http://www.w3.org/TR/xslt#section-HTML-Output-Method

"The html output method should output boolean attributes (that is
attributes with only a single allowed value that is equal to the name of
the attribute) in minimized form. For example, a start-tag written in
the stylesheet as

<OPTION selected="selected">
should be output as

<OPTION selected>"

HTH

> -----Original Message-----
> From: Roland [mailto:roland@netquant.com.br] 
> Sent: Tuesday, April 16, 2002 3:53 PM
> To: Gary L Peskin; Xalan-j-users@xml.apache.org
> Subject: RE: <xsl:copy-of> eating attribute values
> 
> 
> At 03:32 PM 4/16/02 -0700, Gary L Peskin wrote:
> >Have you specified an output method of HTML or is the first element 
> >output <html>?
> 
> <xsl:output method="html"/>
> 
> This is in the stylesheet, so I would say yes.
> 
> Roland
> 


RE: eating attribute values

Posted by Roland <ro...@netquant.com.br>.
At 03:32 PM 4/16/02 -0700, Gary L Peskin wrote:
>Have you specified an output method of HTML or is the first element
>output <html>?

<xsl:output method="html"/>

This is in the stylesheet, so I would say yes.

Roland


RE: eating attribute values

Posted by Gary L Peskin <ga...@firstech.com>.
Have you specified an output method of HTML or is the first element
output <html>?

Gary

> -----Original Message-----
> From: Roland [mailto:roland@netquant.com.br] 
> Sent: Tuesday, April 16, 2002 3:24 PM
> To: Xalan-j-users@xml.apache.org
> Subject: <xsl:copy-of> eating attribute values
> 
> 
> Hello
> 
> I noticed a strange behaviour when using it for the following:
> 
> In my XML file I have this line:
> <option selected="selected">False</option>
> 
> In my XSL file I want to copy that node with:
> <xsl:copy-of select="./option"/>
> 
> If I do that the result will be:
> 
> <option selected>False</option>
> 
> The attribute value has dissappeared!
> Note that this doesn't happen if the attribute value is 
> DIFFERENT than the 
> attribute name. For example with
> 
> <option selected="Blue">False</option>
> 
> It will work as expected.
> Is this a bug or default behaviour that I don't know about?
> 
> Best regards,
> Roland
>