[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] double quotes in attributes


Subject: Re: [xsl] double quotes in attributes
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Tue, 27 Aug 2002 17:38:27 -0400

[yan bai]
> I have some xml files which is produced by server.
> Since xml files are produced from many sources, some
> of them contains double quotes in attribute values.
> e.g.
>    <info seq="21"
>          bind="S000003"
>          text="Alarm Status 00000100 stream-id="0
>           LowAlarm"" />
> I need to transform the xml file which contains
> attribute values very similar to the above example
> into another xml file by using xsl.
>
> How should I handle the double quote problem here in
> xsl?

If the "xml" file is really exactly as you have copied it here, it is not
well-formed xml, because in xml the double quotes cannot be nested like
that.  No true xml processor (which includes xslt processors) can handle the
data.

Therefore you must fix the data first, before sending to an xml processor.
If __you__ are producing the "xml" files from those many sources, you need
to change your producing software, otherwise work up some code in Python,
perl, awk, or java, etc., whichever you can use the easiest, and convert
these files into well-formed xml.

Cheers,

Tom P


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords