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

Converting an element tree to a string representation

Subject: Converting an element tree to a string representation
From: Nicholas Piper <nick-xsllist@xxxxxxxxxxxxxxx>
Date: Wed, 3 Sep 2003 16:22:39 +0100
tree string representation
I've had a good look at http://www.dpawson.co.uk/xsl/index.html, and
google. Google is hard, because I can't think of good keywords; I may
have missed something in the list archive for that reason too.

I'm trying to write a series of XSLT files to transform an
XHTML+MathML document into new documents that can be shown on 'big
browsers', PDA browsers, WML phones, etc.

I'm planning to manage the MathML thin browsers by converting a block
like this:

 <math xmlns="http://www.w3.org/1998/Math/MathML">
  <mi>S</mi>
 </math>

in my source document, to this in my output document:

<img src="http://i.haus/i/el/mathml_to_png.py?math=%3Cmath++++
          xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1998%2FMath%2FM
          athML%22%3E%3Cmi%3ES%3C%2Fmi%3E%3C%2Fmath%3E">

(obviously without the line breaks).

Then my python script converts that XML fragment into a PNG, or WBMP,
etc. I've got the server-side part sorted, but am having very great
difficulty trying to convince my xslt engine (xmlspy, xsltproc) to
output what I'd like.

My current attempt looks like:

 <xsl:template match="math:math">
  <img>
   <xsl:attribute name="src">
    http://i.haus/cgi-bin/mathmltopng?m=<xsl:value-of select="."/>
   </xsl:attribute>
  </img>
 </xsl:template>

But of course this doesn't work, I just get 

 [...] src="http://i.haus/cgi-bin/mathmltopng?m=Cost=_n=1_(-1)nn" [...]

as it concatenates together the text nodes, rather than reproducing
the node as a string.

Is what I want to do possible? Should I pre or post-process the file
with a parser of my own, instead of trying to do this with an XSLT
engine? That doesn't seem quite as nice.

Thank you,

 Nick

-- 
Part 4 MEng Cybernetics; Reading, UK       http://www.nickpiper.co.uk/
GPG Encrypted mail welcome!                             1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.