[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Node Values Contain Entities: Can't Get Correct Output

Subject: Node Values Contain Entities: Can't Get Correct Output
From: B K Partridge <derangedwombat@xxxxxxxxx>
Date: Sun, 31 Aug 2003 15:03:21 -0700 (PDT)
get node value
I am sorry to ask this.  I know this is probably not
allowed to ask.  But I **can't** figure this out.  I
have tried for *days*...and I'm not kidding.  Someone
please take pity on me.



I have an xml document with parts like this:

<m:math mode="display">

Obviously, when I run this through the processor, in
place of "&middot;" I get, a mid-dot.  That's cool.

But I don't want a mid-dot in my document.  I want
this: &middot

The first thing I tried, was changing the input to
&amp;middot;  Well, that unfortunately didn't work. 
If I started with &amp;middot; I ended up with
&amp;middot and NOT &middot; -- for some reason, which
I just don't understand.

So, then, I tried this as the input:

<m:mo><[!CDATA [ &middot; ]]></m:mo>

and I tried this as the processing code:

<xsl:template match="m:math">
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
	<xsl:variable name="amp" select="'&amp;'" />
	<xsl:for-each select="descendant::*">
	<xsl:when test="contains(.,$amp)">
	<xsl:variable name="curname" select="name(.)"/>
	<xsl:element name="{$curname}"
	     <xsl:value-of disable-output-escaping="yes"
		<xsl:copy-of select="."/>

Now, I realize this isn't perfect. For one thing, it
doesn't do anything about situations where I have a
entity in a node that has attributes - I'm not copying
those in the first instance.  But there are other
things wrong with this that I can't figure out - first
of all - it DOESN'T ignore escaping on the value of
the node, secondly, it doesn't put the new element in
the right namespace even though I have namespace m
declared in the stylesheet at the mathML namespace and
I specify the namespace AGAIN where I'm attempting to
construct the element.

Any help anyone would be kind enough to offer would be
greatly greatly appreciated.



Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.