Re: XSLT/XPATH problem, possible bug

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Liberty Development
Message-ID <[email protected]>
Michael Hansen wrote:
>>My reading of <http://www.w3.org/TR/REC-xml/#dt-chardata> is that you
>>do not need to escape the ampersand '&' in a processing instruction:
>>
>>"The ampersand character (&) and the left angle bracket (<) MUST NOT
>>appear in their literal form, _except_ when used as markup delimiters,
>>or within a comment, a processing instruction, or a CDATA section."
>>
>>So you would simply need to write your xml-stylesheet processing
>>instruction with unescaped ampersands (e.g.
>>  &filter=Rock
>>) and all is fine, Mozilla will then make the proper URL request and
>>your PHP script will have the proper $_GET variables.
>>
>>That is what the XML specification gives.
> 
> 
> Aha, so strictly speaking it is not a bug. However it would make this a 
> great deal easier if encoded ampersands were allowed here too (in terms of 
> workflow).
> 
> Thanks for clearing this up,

Things are more complex, the specification xml-stylesheet, 
<http://www.w3.org/TR/xml-stylesheet/>, defines xml-stylesheet as a 
processing instruction but then makes further syntax restrictions on the 
data of the processing instruction where
<http://www.w3.org/TR/xml-stylesheet/#The%20xml-stylesheet%20processing%20instruction>
defines pseudo attributes and their syntax as

[1]    	StyleSheetPI 	   ::=    	'<?xml-stylesheet' (S PseudoAtt)* S? '?>' 	
[2]    	PseudoAtt 	   ::=    	Name S? '=' S? PseudoAttValue 	
[3]    	PseudoAttValue 	   ::=    	('"' ([^"<&] | CharRef | 
PredefEntityRef)* '"' 	
			| "'" ([^'<&] | CharRef | PredefEntityRef)* "'") 	
			- (Char* '?>' Char*) 	
[4]    	PredefEntityRef 	   ::=    	'&amp;' | '&lt;' | '&gt;' | '&quot;' 
| '&apos;'

which means reading the XML specification does not suffice, the 
xml-stylesheet specification makes e.g.
   href="someURI"
a pseudo attribute value where in the attribute value any '<' or '&' 
unescaped is disallowed while '&lt;' and '&amp;' are allowed and 
necessary it seems.

So with that specification it seems any processor making an HTTP request 
on the URI in the href pseudo attribute should unescape any '&amp;' as 
'&' as the value of the pseudo attribute is "the value after each 
reference is replaced by the character it references".

It looks like Mozilla has a bug after all, I might file one tomorrow if 
noone shows up in the meantime opposing to the above reasoning.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.