Subject: Re: [xsl] How to include a single quote in a parameter string From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 30 Jul 2002 16:04:41 +0100 |
Hi Peiyun, > I have the following in my stylesheet that gives me errors: > > <xsl:param name="fjeestitle" > select="'NRC Research Press: Revue du génie et de la science de > l'environnement'" /> > > Why is this not working? How to make it work? When this gets read by an XML parser, it reports the value of the select attribute to the XSLT (or rather XPath) processor to be: 'NRC Research Press: Revue du génie et de la science de l'environnement' In other words, it's the XML parser's job to resolve the ' character reference into the ' character; that's already been done by the time it gets to the XPath processor. The XPath processor then tries to parse that value as an XPath. It pairs the first ' with the second ' and then tries to parse the part after the second ' as being an operator on that string, which is why you get the error. The solution is to make sure that the XPath processor gets a string that it can parse as an XPath, and since your string has a ' in it, that means using " to delimit the string rather than ': "NRC Research Press: Revue du génie et de la science de l'environnement" Then you can move that into the XML either by delimiting the attribute value with double quotes and escaping the double quotes in the XPath: <xsl:param name="fjeestitle" select=""NRC Research Press: Revue du génie et de la science de l'environnement"" /> or by delimiting the attribute value by single quotes and escaping the single quote in the XPath: <xsl:param name="fjeestitle" select='"NRC Research Press: Revue du génie et de la science de l'environnement"' /> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Thread | Re: Re: [xsl] Passing Command line , Kalyan Kumar Mudumba | |
Date | Re: Re: [xsl] Passing Command line , Kalyan Kumar Mudumba | |
Month |