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

RE: xsl:copy-of O.K. on RTF, but nothing on <EMPTY/> e

Subject: RE: xsl:copy-of O.K. on RTF, but nothing on <EMPTY/> element content (?)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 25 Apr 2003 13:44:41 -0400
copy of space xsl
William,

I've been out for a couple of days, only catching up now, but your message caught my eye.

I can't explain the behavior you are seeing (which processor are you using?). The only difference between models that have a space and those that don't is the presence of that space. xsl:copy-of will create a RTF in either case. So will xsl:apply-templates. Whether a variable refers to a node set or to an RTF depends on how that variable is declared; there too, the presence of a text node won't make a difference as to the data type of what is bound to the variable.

That having been said, I think you could cut the Gordian knot (not worrying about the entanglements) by simply straightening up your code. Instead of using a for-each, try something like this:

<xsl:param name="segment" select="CALIFORNIA"/>

<xsl:variable name="messages" select="document($LookupFilename)//msgs/msg"/>
<!-- binds the set of msg nodes to the variable, once, globally -->

<xsl:template match="main-msg">
  <xsl:variable name="msg-name" select="@name"/>
  <xsl:variable name="msg-fill-contents"
    select="$messages[@name = $msg-name]/segment[@name = $segment]/markup"/>
  <!-- ...do your thing with msg-fill-contents ... BTW it's now a node-set,
       not an RTF as it would be using either apply-templates OR copy-of
       as the contents of the xsl:variable element -->
</xsl:template>

If this or something like it doesn't work, please post again with a reduced example demonstrating the bug (test it before posting ;-).

If this problem isn't actually at the heart of your question, and it doesn't help to warn you that your theory is incorrect (the presence of the space makes what would otherwise be a node-set into an RTF -- it doesn't) ... you have another reason to post back.

I hope that helps--
Wendell

or not should be the presence At 05:30 PM 4/23/2003, you wrote:
My basic question:
(follow-on to my yesterday e-mail)

>> What is the difference in these two bits of markup, from the point of
the
 XSLT processor, working on an <xsl:apply-templates> or an <xsl:copy-of>
instruction? <<

                        +++++++++++++++++++++++++++++++++++++++++++
CODE #1:                <markup> <img src="pic.gif"/></markup>       <<
RTF
                        +++++++++++++++++++++++++++++++++++++++++++
                        +++++++++++++++++++++++++++++++++++++++++++
CODE #2:                <markup><img src="pic.gif"/></markup>        <<
nodeset (I believe(?))
                        +++++++++++++++++++++++++++++++++++++++++++



- KEYSTROKES
The simple difference in keystrokes is one has a space between elements
((#1) <markup> <img>),
the other doesn't ((#2) <markup><img>).

- TREE of NODES
The difference in the tree of nodes visited by the XSLT processor (as
revealed by
CraneSoftwrights "showtree.xsl") is shown further below.
(Essentially, one (#1) has an extra "Text" node).

http://www.cranesoftwrights.com/resources/showtree/showtree-20000610.xsl

- DOES IT WORK?
The difference in getting results to process through
<xsl:apply-templates> and
<xsl:copy-of> is that:
        - GOOD: one works! (the one _with_ the space (#1)),
        - NOT GOOD: and the other does _not_! (#2)(I get "empty node
list" - both Xalan and Saxon).

The error is probably in how the node is selected, not in the fact that one of them has a space....wap



====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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.