[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: converting encoded characters <, > etc
Hi all, Thanks for the DOE tip, it works fine :) I'm not sure if what I did comes under what David described. Basically this part of my transformation is extracting data out from the database to be presented to the user. The data stored may be HTML input for e.g. "<p>Hello World</p>". This is just a sample, it can be any complex combination of tags. When I extract the literal string from there, I insert the whole chunk into a node i.e. "<OutputField1><p>Hello</p></Outfield1>" where OutputField is a node in my XML tree. In ASP, that would be: Set newNode = objNode.createNode(1, "OutField1", "") newNode.Text = "<p>Hello World</p>" Why did I not parse through "<p>Hello World</p>" and derive some nodes from there? Well, 'cos it can be any HTML tag and I'm not confident I'll be able to create a template for all the tags that might appear. This might be a larger issue of me not knowing how to manipulate XSL adequately. So far, I'd been forced to progressively cater for a lot of tags that appear within my XML nodes. For e.g. if I have a node structured as: <MyCustomeNode> <p>Hi <a href="#">again</a></p> </MyCustomeNode> More often than not, I've had to declare a template for MyCustomeNode/p/a to get to the link. "//a" somehow fails to work quite often. I haven't been able to trace the reason for this (sigh, deadlines aren't very forgiving) so far. Oh well, you live you learn... Thanks a lot guys, Wong -----Original Message----- From: Geert Josten [mailto:Geert.Josten@xxxxxxxxxxx] Sent: Wednesday, December 01, 2004 8:33 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: converting encoded characters <, > etc > <xsl:value-of select="-- path to data --" disable-output-escaping="yes" /> > > you could do that (if your system supports disable-output-escaping > but it's always worth suggesting that you change your input. > d-o-e is very much a last resort. Very true. > Specifically, the original poster said: > >>When I manipulate XML data using XMLDOM in ASP, all characters like "<" and >>">" in the XML data gets converted to "<" and ">". > > That is very strange, you would expect that a DOM would end up being > seen by XSLT as a node set of element nodes, so if it is being > linearised, something is probably wrong with the way the DOM has been > built, or XSLT is being called. It actually sounds like Wong is trying to insert XML (or XHTML) data into the DOM tree as character data... Wong, if that is the case, you would be better off when doing a parseXML/loadXML on that data and use DOM functions to move the resulting parse nodes into the larger DOM tree. That way, you will be able to match for those elements in XSL as well... Cheers..
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|