This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Matching attributes that contain both &pos; and "
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Matching attributes that contain both &pos; and "
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Fri, 8 Sep 2000 11:41:02 +0100
- Reply-To: xsl-list at mulberrytech dot com
> However the following example proves troublesome for XT, Saxon
> and Xalan. All of them generate an error.
> <xsl:template match="channel/location[@name=' "x" 'a z']">
It is an error, because it's not well-formed XML.
>
> This might be a flaw with the spec,
It's not really a flaw in the spec: this would be a valid XPath expression,
it's just that you can't use it at this place in a well-formed XML document.
> but given that it isn't, does anyone
> have a work around for how to match this attribute.
Given that variables ca't be used in a template match pattern, I think the
only way around it is with concat().
<xsl:template match="channel/location[
@name=concat('"x"', "'a" z)]">
The trick is to write the XPath expression "naturally", and then replace all
occurrences of " with " regardless whether it's being used as an XPath
string delimiter or as a character within a string.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list