Subject: [xsl] To avoid converting html entities From: Ahsan Ali <doubleletter@xxxxxxxxx> Date: Sat, 11 Jun 2005 08:43:03 +0400 |
Since I'm using XSLT 1.0 (MSXML), I'm forced to resort to manually escaping all the following chars: <> & " EXSLT has a XSLT template for str::replace, but it depends on exsl:node-set() for which there is no XSLT template implementation. Nor do I have access to the XPATH replace function. So I was wondering, has anyone had a similar problem before & written a template for it that I could use ? Thanks, Regards, Ahsan ---------- Forwarded message ---------- From: Ahsan Ali <doubleletter@xxxxxxxxx> Date: Jun 10, 2005 5:23 PM Subject: Re: [xsl] To avoid converting html entities To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Yes.. That's exactly what I wanted: to have this _escaped_ xml fragment as the value of a hidden form variable.. Thanks, Ahsan On 6/10/05, Michael Kay <mike@xxxxxxxxxxxx> wrote: > > What I'm trying to do is: output this same data as the value of a > > hidden element in a form. When the user submits the form, this exact > > data has to be passed to the next web service call.. > > When you say "this exact data", I assume you mean "the XML document that > this data represents". An XML document can't be held in an attribute of an > HTML document except by escaping it, so trying to disable escaping isn't > going to work. Instead you need to unescape the document (i.e., to parse it) > before submitting it to the web service. > > Michael Kay > http://www.saxonica.com/ > > > > > On 6/9/05, Michael Kay <mike@xxxxxxxxxxxx> wrote: > > > > In my xml data source, I have the following element: > > > > > > > > ------------- > > > > <PostData>EK,,,,,75,,,,,DXB,,,,,CDG,,,,,20050901,,,,,1500,,,,, > > > > > 20050901,,,,,2010,,,,,B,,,,,0,430,EK,,,,,74,,,,,CDG,,,,,DXB,,, > > ,,20051001,,,, > > > ,1530,,,,,20051002,,,,,10,,,,,B,,> > > > ,,,0,400,300000,355000,0,0,0,0,AED,86270166,0,0,0,2,0,0,0,,< > > > > ;RulesInfo><UniqueKey>1</UniqueKey><QuoteNum > > > > > > ... > > > > > > yuk. If you have any chance at all of fixing the process > > that created this > > > horror, then do so. > > > > > > > I want to select (and output) the above data, without > > converting the > > > > html entities above to < & >, etc. > > > > > > The XML parser automatically converts < to <, you can't > > prevent that. The > > > XSLT serializer normally converts < back to <. You can > > prevent that, in > > > some circumstances, by using disable-output-escaping. > > > > > > > > The xsl (snippet) is as follows: > > > > > > > > <input type="hidden"> > > > > <xsl:attribute name="value"> > > > > <xsl:value-of select="PostData" disable-output-escaping="yes"/> > > > > </xsl:attribute> > > > > </input> > > > > > > > > The output method is set to html... & I'm using MSXSL > > (i.e xslt 1.0) > > > > > > You can't use disable-output-escaping when writing > > attribute values. And I'm > > > not sure why you want to. What HTML are you actually trying > > to create? > > > > > > Michael Kay > > > http://www.saxonica.com/ > > > > > > > > > > > > -- > > Muted Musings - http://doubleletter.blogspot.com > > -- Muted Musings - http://doubleletter.blogspot.com -- Muted Musings - http://doubleletter.blogspot.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] To avoid converting html , Ahsan Ali | Thread | [xsl] many node values into one??, Wendi Turner |
Re: [xsl] Pipe Question, Karl Stubsjoen | Date | [xsl] grouping where nodes are nest, Charles Macleod |
Month |