[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Node Values Contain Entities: Can't Get Correct Output
Subject: [xsl] 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) |
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. Ahem. Okay... I have an xml document with parts like this: <m:math mode="display"> <m:mrow> <m:mi>tan</m:mi> <m:mfenced> <m:mrow> <m:mn>30</m:mn> <m:mo>·</m:mo> <m:mi>deg</m:mi> </m:mrow> </m:mfenced> </m:mrow> </m:math> Obviously, when I run this through the processor, in place of "·" I get, a mid-dot. That's cool. But I don't want a mid-dot in my document. I want this: · The first thing I tried, was changing the input to &middot; Well, that unfortunately didn't work. If I started with &middot; I ended up with &middot and NOT · -- for some reason, which I just don't understand. So, then, I tried this as the input: <m:mo><[!CDATA [ · ]]></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="'&'" /> <xsl:for-each select="descendant::*"> <xsl:choose> <xsl:when test="contains(.,$amp)"> <xsl:variable name="curname" select="name(.)"/> <xsl:element name="{$curname}" namespace="http://www.w3.org/1998/Math/MathML"> <xsl:value-of disable-output-escaping="yes" select="."/> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:copy-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </m:math> 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. Thanks. </xsl:template> __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT Cookbook - HELP, Wendell Piez | Thread | Re: [xsl] Node Values Contain Entit, Mark Peterson |
Re: AW: AW: [xsl] global variable a, fe . sola | Date | Re: [xsl] Node Values Contain Entit, Mark Peterson |
Month |
Keywords