[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: single quotes instead of double
At 2011-11-21 11:44 +0000, Andrew Welch wrote:
On 21 November 2011 11:35, Szabo, Patrick (LNG-VIE) <patrick.szabo@xxxxxxxxxxxxx> wrote: > Hi, > > I'm currently working together with external developers and they sent me > a stylesheet that has the following code in it: > > <xsl:when test="$mode = 'versionbranch'"> > <xsl:value-of select='$documentid'/> > </xsl:when> > > As you can see there are single quotes where normally at least i would > write double quotes. > > I'm wondering if that could make any difference in any circumstances. I disagree with making this generalization. The general rule is - use double quotes. It is purely a matter of convenience for the writer of the expression. And an XSLT processor can choose either quote to use as an attribute literal delimiter. I feel *obliged* to use single quotes for an attribute in XSLT that uses the "url()" syntax in an XSL-FO stylesheet because of the allowed characters in a URI: <external-graphic src='url("{$uri}")'/> Because a single quote is allowed in a valid URI, double quotes inside the url() are necessary. Of course I could have written the above as: external-graphic src="url("{$uri}")" or: external-graphic src="url("{$uri}")" and used double quotes for the attribute delimiter, but I think this is harder to maintain down the road for someone reading the numeric character entities. For someone reading XML, the attribute delimiter chosen should be irrelevant because it is, syntactically, irrelevant. So use whatever you want and don't bother imposing a style. I find I simply use as the closing delimiter whichever quote I happened to type for the opening delimiter, which is not always a double-quote. Sure, it usually is, but since it doesn't have to be I don't force myself. I hope this helps. . . . . . . . . . . . Ken -- Contact us for world-wide XML consulting and instructor-led training Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|