re:
!I found an MSDN document that explains why what I'm trying to do should work
Lee,
From :
"A special attribute named xml:lang may be inserted in documents to specify the
language used in the contents and attribute values of any element in an XML document."
If anything, I can see xml:lang being declared for specific content values, for example :
<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>
Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?
A similar explanation is given here :
---000---
<SECTION>
<DESCRIPTION xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
</QUOTE>
---000---
That's perfectly good usage for xml:lang, as a parser could selectively identify content in different languages.
But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).
So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.
If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.
If there's a need to identify that the *contents* of a particular markup tag are in a
specific language, that identification can be included in the tag itself, for example :
<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>
That makes a lot more sense than setting xml:lang for the attribute values in the html tag.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no.spam@spamme r.comwrote in message news:%23ocUnoI2 IHA.2188@TK2MSF TNGP04.phx.gbl. ..
!I found an MSDN document that explains why what I'm trying to do should work
Lee,
From :
"A special attribute named xml:lang may be inserted in documents to specify the
language used in the contents and attribute values of any element in an XML document."
If anything, I can see xml:lang being declared for specific content values, for example :
<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>
Then, an xml parser could identify regional US and British spellings but, given that *all* the attribute values
must be in English in an html doc, what would be the purpose of declaring xml:lang for the html markup ?
A similar explanation is given here :
---000---
<SECTION>
<DESCRIPTION xml:lang="en">
Caesar begins by describing the geography of Gaul.
</DESCRIPTION>
<QUOTE xml:lang="la">
Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.
</QUOTE>
---000---
That's perfectly good usage for xml:lang, as a parser could selectively identify content in different languages.
But, it seems to me that setting xml:lang for the html tag's *attribute* values is unneeded, since they must
be in English, and they must be attributes set to a language identifier, as defined by IETF RFC 4646
(http://www.ietf.org/rfc/rfc4646.txt).
So, I think that requisite pretty well establishes the futility
of setting xml:lang for all the attributes in an html document.
If anything, it seems that the xml:lang attribute is included in the
html server tag for compatibility purposes, or perhaps out of ignorance.
If there's a need to identify that the *contents* of a particular markup tag are in a
specific language, that identification can be included in the tag itself, for example :
<div lang="MX-es" xml:lang="MX-es">
Algo de contenido en español mejicano.
</div>
That makes a lot more sense than setting xml:lang for the attribute values in the html tag.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Lee C." <no.spam@spamme r.comwrote in message news:%23ocUnoI2 IHA.2188@TK2MSF TNGP04.phx.gbl. ..
>I found an MSDN document that explains why what I'm trying to do should work.
>
ASP.NET Web Server Controls Overview
>
Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the explanation
of "pass-through" attributes for HTML Server Controls.
>
Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server control by adding the attribute runat="server".
2. You can add any attributes you need to an HTML server control and the page framework will render them without
any change in functionality.
>
, Lee
>
"Lee C." <no.spam@spamme r.comwrote in message news:Oe38JYI2IH A.4772@TK2MSFTN GP03.phx.gbl...
>
>
>
ASP.NET Web Server Controls Overview
>
Note the distinction between HTML Server Controls and Web Server Controls in the document. Also, note the explanation
of "pass-through" attributes for HTML Server Controls.
>
Two quotes that sum it up:
1. Any HTML element on a page can be converted to an HTML server control by adding the attribute runat="server".
2. You can add any attributes you need to an HTML server control and the page framework will render them without
any change in functionality.
>
, Lee
>
"Lee C." <no.spam@spamme r.comwrote in message news:Oe38JYI2IH A.4772@TK2MSFTN GP03.phx.gbl...
>Juan,
>>
>I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]
>>
>I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I did just
>that as a work around (right after I discovered this bug); but, I should not have to.
>>
>I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic, none of the
>declarative (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all of them
>(xmlns, lang, and dir) do--except xml:lang.
>>
>I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively. With *no*
>5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server", which does
>not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and dir), I
>only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or 0, and
>4 is right. Not 0...and not 3.
>>
>When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while keeping
>the other three attributes as "html" attributes. All four are still "html" attributes--which should render.
>>
>I think the simplification of my example may be confusing you. It is odd that, in my example, I set runat="server"
>but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.) Well,
>in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
>script). I have:
>>
><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
> dir="ltr">
>>
>Both of those declarative explicit localization expressions should work without my having to write any more
>"procedural " (code-beside) code or script. It actually does work fine for the lang attribute--as it should; but not
>for the xml:lang attribute--***which is a bug***.
>>
>, Lee
>>
>"Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message news:u0WzB9H2IH A.4188@TK2MSFTN GP04.phx.gbl...
>>
>>
>>
>I appreciate your trying to help, but you're wrong, and you are the one who is confused. :]
>>
>I am *not* disputing that when inserted programmaticall y, the xml:lang attribute renders to the browser. I did just
>that as a work around (right after I discovered this bug); but, I should not have to.
>>
>I am *not* confusing html attributes with runat="server" attributes, as you call them. Using your logic, none of the
>declarative (html) attributes should render to the browser after I add the runat="server" in ASP.NET; yet all of them
>(xmlns, lang, and dir) do--except xml:lang.
>>
>I started with an html element with 4 attributes (xmlns, lang, xml:lang, and dir) all set declaratively. With *no*
>5th attribute of runat="server", all 4 attributes render. If I add the 5th attribute of runat="server", which does
>not and should not render, I no longer get all 4 attributes that should render (xmlns, lang, xml:lang, and dir), I
>only get 3 (xmlns, lang, and dir). My logic says I should get 4, your says I should get 3? It would be 4 or 0, and
>4 is right. Not 0...and not 3.
>>
>When I add runat="server", it does not magically make the xml:lang attribute a server-side attribute, while keeping
>the other three attributes as "html" attributes. All four are still "html" attributes--which should render.
>>
>I think the simplification of my example may be confusing you. It is odd that, in my example, I set runat="server"
>but do not have any server-side attributes. (I have all 4 as literal strings, for simplicity of an example.) Well,
>in my real-world use, I do have server-side attributes, which I want set declaratively (no code-beside and no
>script). I have:
>>
><html runat="server" xmlns="http://www.w3.org/1999/xhtml"
> xml:lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
> lang="<%$ Resources:Globa lLang, ContentAudience Language %>"
> dir="ltr">
>>
>Both of those declarative explicit localization expressions should work without my having to write any more
>"procedural " (code-beside) code or script. It actually does work fine for the lang attribute--as it should; but not
>for the xml:lang attribute--***which is a bug***.
>>
>, Lee
>>
>"Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message news:u0WzB9H2IH A.4188@TK2MSFTN GP04.phx.gbl...
>>re:
>>!I think you are misunderstandin g, Juan.
>>>
>>Well, I think you are misunderstandin g *me*.
>>>
>>re:
>>!I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>...and it renders to the browser, as it should.
>>>
>>Yes, because it's standard html.
>>>
>>re:
>>!If I simply add runat="server"
>>>
>>That declares the control to run server side.
>>>
>>For any attribute to be programmed server-side you need a script,
>>just as you need a script to modify any server control's attributes.
>>>
>>Did you run the sample page I sent ?
>>>
>>It iterates throught the attributes for the html server control,
>>and shows that the xml:lang attribute *is* added programmaticall y.
>>>
>>re:
>>!If I simply add runat="server", leaving in the xml:lang attribute that
>>!renders without runat="server", all of the (declarative) attributes are
>>!rendered to the browser--except the xml:lang attribute! That is a bug.
>>>
>>I think you're confusing html attributes with runat="server" attributes.
>>>
>>Html attributes can be inserted in normal html.
>>Server-side attributes must be inserted in code.
>>>
>>Maybe I'm not explaining this as well as I should.
>>Try to get someone else's opinion on this matter, if you don't accept mine.
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>============= =============== ==========
>>"Lee C." <no.spam@spamme r.comwrote in message news:enam1gH2IH A.4552@TK2MSFTN GP04.phx.gbl...
>>>>I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>>
>>><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>...and it renders to the browser, as it should.
>>>>
>>>If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all of the
>>>(declarative ) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.
>>>>
>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>Cordially,
>>>Lee
>>>>
>>>>
>>>"Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message news:eyrwjUH2IH A.3920@TK2MSFTN GP02.phx.gbl...
>>>>Here's a full example which shows that the xml:lang attribute is added programmaticall y :
>>>>>
>>>>attributes. aspx:
>>>>----------------------
>>>><%@ Page Language="C#" AutoEventWireup ="True" %>
>>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
>>>><script language="C#" runat="server">
>>>>void Page_Load(Objec t sender, EventArgs e)
>>>>{
>>>>Myid.Attrib utes.Add("xml:l ang", "es");
>>>>Message.Inn erHtml = "<h4>The html control attributes collection contains:</h4>";
>>>>IEnumerat or keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>while (keys.MoveNext( ))
>>>>{
>>>>String key = (String)keys.Cu rrent;
>>>>Message.Inn erHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>>}
>>>>}
>>>></script>
>>>><head id="Head1" runat="server">
>>>><title>Th e html control attributes collection</title>
>>>></head>
>>>><body>
>>>><form id="Form1" runat="server">
>>>><h3>HtmlCon trol Attribute Collection Example</h3>
>>>><br />
>>>><span id="Message" enableviewstate ="false" runat="server" />
>>>></form>
>>>></body>
>>>></html>
>>>>----------------
>>>>>
>>>>I don't think it's a bug to have to add an attribute programmaticall y,
>>>>because the runat="server" tag only *declares* the html control as a programmable control.
>>>>>
>>>>To actually program it, you must use a script.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>Juan T. Llibre, asp.net MVP
>>>>asp.net faq : http://asp.net.do/faq/
>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>=========== =============== ============
>>>>"Lee C." <no.spam@spamme r.comwrote in message news:e0rLaPG2IH A.4772@TK2MSFTN GP03.phx.gbl...
>>>>>Thanks, Juan.
>>>>>>
>>>>>I already added similar code to a page event in my masterpage code-beside.
>>>>>>
>>>>> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>>>>>
>>>>>To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I
>>>>>original ly
>>>>>posted about is a bug, or if this is actually happening for a reason.
>>>>>>
>>>>>Cordiall y,
>>>>>Lee
>>>>>>
>>>>>>
>>>>>"Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message news:%23gBUqSC2 IHA.4772@TK2MSF TNGP03.phx.gbl. ..
>>>>>>Hi, Lee.
>>>>>>>
>>>>>>re:
>>>>>>!<html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>!no xml:lang attribute is rendered to the browser!
>>>>>>!Remove the runat="server", and, voila, the xml:lang attribute is rendered.
>>>>>>>
>>>>>>Try this :
>>>>>>>
>>>>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>>>>>
>>>>>><script runat="server">
>>>>>>someID.At tributes("xml:l ang") = "en-US"
>>>>>></script>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>Juan T. Llibre, asp.net MVP
>>>>>>asp.net faq : http://asp.net.do/faq/
>>>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>>>========= =============== ==============
>>>>>>>
>>>>>>"Lee C." <nomail@spam.co mwrote in message news:O%23KsAQA2 IHA.4572@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>
>>>>>>>In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It appears that
>>>>>>>ASP.NE T
>>>>>>>eats the xml:lang attribute on the html element when it is set to runat="server".
>>>>>>>>
>>>>>>>Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>>>>>simplici ty,
>>>>>>>try this:
>>>>>>>>
>>>>>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>
>>>>>>>...And you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server", and,
>>>>>>>voila,
>>>>>>>the
>>>>>>>xml:la ng attribute is rendered. :[
>>>>>>>>
>>>>>>>...Any ideas?
>>>>>>>>
>>>>>>>Cordiall y,
>>>>>>>Lee
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>!I think you are misunderstandin g, Juan.
>>>
>>Well, I think you are misunderstandin g *me*.
>>>
>>re:
>>!I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>...and it renders to the browser, as it should.
>>>
>>Yes, because it's standard html.
>>>
>>re:
>>!If I simply add runat="server"
>>>
>>That declares the control to run server side.
>>>
>>For any attribute to be programmed server-side you need a script,
>>just as you need a script to modify any server control's attributes.
>>>
>>Did you run the sample page I sent ?
>>>
>>It iterates throught the attributes for the html server control,
>>and shows that the xml:lang attribute *is* added programmaticall y.
>>>
>>re:
>>!If I simply add runat="server", leaving in the xml:lang attribute that
>>!renders without runat="server", all of the (declarative) attributes are
>>!rendered to the browser--except the xml:lang attribute! That is a bug.
>>>
>>I think you're confusing html attributes with runat="server" attributes.
>>>
>>Html attributes can be inserted in normal html.
>>Server-side attributes must be inserted in code.
>>>
>>Maybe I'm not explaining this as well as I should.
>>Try to get someone else's opinion on this matter, if you don't accept mine.
>>>
>>>
>>>
>>Juan T. Llibre, asp.net MVP
>>asp.net faq : http://asp.net.do/faq/
>>foros de asp.net, en español : http://asp.net.do/foros/
>>============= =============== ==========
>>"Lee C." <no.spam@spamme r.comwrote in message news:enam1gH2IH A.4552@TK2MSFTN GP04.phx.gbl...
>>>>I think you are misunderstandin g, Juan. I had the xml:lang attribute in the html tag (declaratively) , like this:
>>>>
>>><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>...and it renders to the browser, as it should.
>>>>
>>>If I simply add runat="server", leaving in the xml:lang attribute that renders without runat="server", all of the
>>>(declarative ) attributes are rendered to the browser--except the xml:lang attribute! That is a bug.
>>>>
>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>
>>>Cordially,
>>>Lee
>>>>
>>>>
>>>"Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message news:eyrwjUH2IH A.3920@TK2MSFTN GP02.phx.gbl...
>>>>Here's a full example which shows that the xml:lang attribute is added programmaticall y :
>>>>>
>>>>attributes. aspx:
>>>>----------------------
>>>><%@ Page Language="C#" AutoEventWireup ="True" %>
>>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="Myid" >
>>>><script language="C#" runat="server">
>>>>void Page_Load(Objec t sender, EventArgs e)
>>>>{
>>>>Myid.Attrib utes.Add("xml:l ang", "es");
>>>>Message.Inn erHtml = "<h4>The html control attributes collection contains:</h4>";
>>>>IEnumerat or keys = Myid.Attributes .Keys.GetEnumer ator();
>>>>while (keys.MoveNext( ))
>>>>{
>>>>String key = (String)keys.Cu rrent;
>>>>Message.Inn erHtml += key + "=" + Myid.Attributes[key] + "<br />";
>>>>}
>>>>}
>>>></script>
>>>><head id="Head1" runat="server">
>>>><title>Th e html control attributes collection</title>
>>>></head>
>>>><body>
>>>><form id="Form1" runat="server">
>>>><h3>HtmlCon trol Attribute Collection Example</h3>
>>>><br />
>>>><span id="Message" enableviewstate ="false" runat="server" />
>>>></form>
>>>></body>
>>>></html>
>>>>----------------
>>>>>
>>>>I don't think it's a bug to have to add an attribute programmaticall y,
>>>>because the runat="server" tag only *declares* the html control as a programmable control.
>>>>>
>>>>To actually program it, you must use a script.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>Juan T. Llibre, asp.net MVP
>>>>asp.net faq : http://asp.net.do/faq/
>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>=========== =============== ============
>>>>"Lee C." <no.spam@spamme r.comwrote in message news:e0rLaPG2IH A.4772@TK2MSFTN GP03.phx.gbl...
>>>>>Thanks, Juan.
>>>>>>
>>>>>I already added similar code to a page event in my masterpage code-beside.
>>>>>>
>>>>> elHtml.Attribut es.Add("xml:lan g", Resources.Globa lLang.ContentAu dienceLanguage)
>>>>>>
>>>>>To me, that is a temporary workaround. I still want to understand whether the "eating" of the attribute I
>>>>>original ly
>>>>>posted about is a bug, or if this is actually happening for a reason.
>>>>>>
>>>>>Cordiall y,
>>>>>Lee
>>>>>>
>>>>>>
>>>>>"Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message news:%23gBUqSC2 IHA.4772@TK2MSF TNGP03.phx.gbl. ..
>>>>>>Hi, Lee.
>>>>>>>
>>>>>>re:
>>>>>>!<html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>!no xml:lang attribute is rendered to the browser!
>>>>>>!Remove the runat="server", and, voila, the xml:lang attribute is rendered.
>>>>>>>
>>>>>>Try this :
>>>>>>>
>>>>>><html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="someID">
>>>>>>>
>>>>>><script runat="server">
>>>>>>someID.At tributes("xml:l ang") = "en-US"
>>>>>></script>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>Juan T. Llibre, asp.net MVP
>>>>>>asp.net faq : http://asp.net.do/faq/
>>>>>>foros de asp.net, en español : http://asp.net.do/foros/
>>>>>>========= =============== ==============
>>>>>>>
>>>>>>"Lee C." <nomail@spam.co mwrote in message news:O%23KsAQA2 IHA.4572@TK2MSF TNGP03.phx.gbl. ..
>>>>>>>>I think I have discovered a bug in ASP.NET, related to I18N.
>>>>>>>>
>>>>>>>In ASP.NET 3.5 I have to set runat="server" on the html element to use explicit expressions. It appears that
>>>>>>>ASP.NE T
>>>>>>>eats the xml:lang attribute on the html element when it is set to runat="server".
>>>>>>>>
>>>>>>>Of course I want to replace the hardcoded "en-US" values with (resource) explicit expressions; but, for
>>>>>>>simplici ty,
>>>>>>>try this:
>>>>>>>>
>>>>>>><html runat="server" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
>>>>>>>>
>>>>>>>...And you will find that no xml:lang attribute is rendered to the browser! Remove the runat="server", and,
>>>>>>>voila,
>>>>>>>the
>>>>>>>xml:la ng attribute is rendered. :[
>>>>>>>>
>>>>>>>...Any ideas?
>>>>>>>>
>>>>>>>Cordiall y,
>>>>>>>Lee
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
Comment