At 2011-11-21 11:44 +0000, Andrew Welch wrote:
On 21 November 2011 11:35, Szabo, Patrick (LNG-VIE)
<patrick(_dot_)szabo(_at_)lexisnexis(_dot_)at> 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.
No but while it's technically legal it's inconsistent with the line
above, and with xslt style in general.
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(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--