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

RE: Can I print well-formed XML/HTML in text output mo

Subject: RE: Can I print well-formed XML/HTML in text output mode
From: "Nathaniel Stoddard" <nathaniel@xxxxxxxxxxxxxxxx>
Date: Sun, 26 Oct 2003 11:17:02 -0800
xsl print text
Well, that didn't work for me.  Let me show you a quick XML and XSLT files
so you can see what it is doing for me.

The XML file:
-----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<test>
    <something>
        <p>Hey, dangit work!</p>
    </something>
</test>
-----------------------------------------------
The XSLT file:
<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text"/>

    <xsl:template match="/test">
        <xsl:copy-of select="something" />
        <xsl:value-of select="something" />
    </xsl:template>
</xsl:stylesheet>
-----------------------------------------------
The output:

        Hey, dangit work!
    
        Hey, dangit work!
-----------------------------------------------

The specs on the W3C website say that when I print out a node in text mode,
it will take the text values from each descendant node printing each.  As a
result, I should expect all my tags and attributes to be stripped, and all
the actual values of the tags to be concatenated together and lovingly spit
out.

Of course I don't want this.  The copy-of solution didn't work for me.  But
then of course I'm not really sure what a p-node is, so maybe that's my
problem.

Anything else?


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Andreas L.
Delmelle
Sent: Sunday, October 26, 2003 3:47 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Can I print well-formed XML/HTML in text output mode

> -----Original Message-----
> From: Nathaniel Stoddard
>
> When I do the <xsl:value-of select="my_node" /> then it just does a messy
> output.  If "my_node" is "<p>Hey, this stupid thing won't work right</p>"
> then it will proceed to print "Hey, this stupid thing won't work
> right".  As

Actually, the stupid thing *is* working right if my_node is the p-node :)

> fun as that is, it doesn't look too nice later when it shows up on a
> webpage.  (I can't just put the <p> and </p> around the thing because the
> data in the node is PCDATA, so any html can be in there.)  I'd
> like a simple
> value-of statement, but apparently that's a no-go since it is in text mode
> and text mode will take the text only in all the descendent
> nodes, and leave
> out the tags.
>

Use <xsl:copy-of select="my_node" /> for this.

Hope this helps!

Cheerz,

Andreas


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






 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.