Re: [xsl] force apostrophed attribute values

Subject: Re: [xsl] force apostrophed attribute values
From: Abel Online <>
Date: Tue, 29 Aug 2006 12:07:59 +0200
The short answer: no.

But I can think of several tricks you might pull off to get this done anyway. But that will not be regular usage of XSLT (here's some but not all info, hidden in another subject:

Trick 1: use a filter after parsing XSLT. This filter should be smart enough to know to find attribute values and fieldnames, dealing correctly with whitespace and escaping any single quotes inside the attribute value.

Trick 2: same as trick one, but now you use XSLT for it. In this second phase (the filter phase), you open the result of your transformation using unparsed-text(yourdoc.xml). You output it as text. You parse each line in yourdoc.xml as if it were a regular text file and use the regular expression matching mechanism of XSLT to do the work for you. This requires XSLT 2.0.

Perhaps some processors have extension methods that you can use to force single quotes on output, but I don't know of any.

Abel Braaksma

Frank Marent wrote:

is there a way in xslt to force the creation of xml files with apostrophed attributes instead of quotation marked values?

not: <Element attribute="value">

but: <Element attribute='value'>

the reason why we need apostrophes is that a silly application we're using seems to accept only apostrophed values and quotation marks are causing troubles.

thanks to all


Current Thread