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

Re: Newbie question, commenting out an element

Subject: Re: Newbie question, commenting out an element
From: "Douglas Wade" <douglaswade@xxxxxxxxx>
Date: Sun, 21 Dec 2008 10:39:50 -0800
Re:  Newbie question
Thank you ... I had thought of using perl. In fact the transformation
script is a perl script that first converts from SGML to XML and then
changes graphic names and bunch of other strings. The problem for me
with perl is that I have to do more work to handle items, like
elements starting on one line and finishing on another. I wanted to
move from my serial and string based approach to XSL thinkin' I could
get my skills more current and do more with less effort.

D


On Sat, Dec 20, 2008 at 11:05 PM, Deborah Pickett
<debbiep-list-xsl@xxxxxxxxxx> wrote:
> Hi Douglas,
>
> Douglas Wade wrote:
>> <applic><assert></assert></
>> applic>
>> to
>> <!-- <applic><assert></assert></applic> -->
>
> The reason this isn't working for you is that XSLT doesn't produce
> serialized XML (at least, not directly).  It produces a result tree
> (think of something like a DOM tree), which is serialized to XML by
> another agent*.  In other words, XSLT works on elements and nodes, not
> tags and text.
>
> It's not allowed for an XML result tree to have comment nodes (made with
> <xsl:comment>) with child nodes other than text.  If you try something like
>
> <xsl:comment><xsl:element name="foo"/></xsl:comment>
>
> you will get an error reminding you of this.
>
> That said, there are a couple of ways you can do this.  One is to not
> use XSLT at all, and treat this as a text-substitution problem to be
> done in a general text-processing language like Perl.  The other is to
> use an XPath extension function such as saxon:serialize(), which can
> turn an XML result tree into a string that represents the tree, which
> you can then stick into your output with <xsl:value-of>.
>
> Whichever way you go, you will need to ensure that the comment never
> contains the sequence of characters "--", which is forbidden in XML
> comments to prevent the possibility of comments nesting.
>
> * That agent is usually your XSLT processor, after it has finished
> processing the stylesheet, but XSLT processors don't have to do this.

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.