RE: [xsl] xslt replace special characters

Subject: RE: [xsl] xslt replace special characters
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Mon, 11 Nov 2002 17:07:38 -0500
[ Alice Fan]
> once i get the variable from the user...i'll insert 
> that as a hidden 
> input element.  If I do this....I can tell the xslt to look 
> for this hidden 
> input element and get the variable from there.  right?

I think so but I am not quite sure what you mean.  Here is what I meant

1) User enters url into an HTML form in a browser.

2) Javascript on the browser cleans up the URL, url encodes it if
necessary, and escapes special characters like "&".

Now there are several possibilities, of which I will only list two -

3a) You create a string containing well-formed xml, including an element
that contains the escaped url, in a hidden field in a form.  You submit
the form using javascript.  The server extracts the xml from the form
variable and transforms the string using the xslt stylesheet.

3b) You put the cleaned and escaped url string into a field in a form
and submit it to the server using javascript.  No xml is involved - just
ordinary html form data.  On the server, you take the url value, create
some xml to hold it, and then transform it.  Note that you might not
even want to escape the "&" on the browser, depending on how you intend
to create the xml (you might escape it as you create the xml).

You will have to figure out which approach you want to take.  There are
other, Microsoft-specific things waus you could do this on the browser,
but if you want to interoperate with other browsers, these are the prime


Tom P

> >From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
> >[Alice Fan]
> >
> > > I was looking into the '&' problem somemore.  What if I 
> used CDATA 
> > > in my XML file so when its trying to parse it will ignore those 
> > > special characters.  I
> > > think this might work.  Any ideas on this possible solution?
> > >
> >
> >Just as long as you do not put the PCDATA into an attribute 
> - you cannot
> >put a CDATA section there.  You can, of course, put it into 
> the content
> >of an element.  I say this because a  common way to send xml 
> back to a
> >server is to put it into a hidden input element, and in that 
> case it has
> >to go as the value of the "value" attribute of the hidden field.
> >
> >Why not just use Javascript to escape the "&" characters?
> >

 XSL-List info and archive:

Current Thread