Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] converting encoded characters <, > etc

From: "Wong Chin Shin" <publicbbs@---------------->
To:
Date: 12/1/2004 1:08:00 PM
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: [xsl] 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 "&lt;" and "&gt;".
> 
> 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..


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent