RE: [xsl] xsl:copy-of O.K. on RTF, but nothing on <EMPTY/> element content (?)

Subject: RE: [xsl] 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

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"/>
  <!-- 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 -->

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--

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
 XSLT processor, working on an <xsl:apply-templates> or an <xsl:copy-of>
instruction? <<

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

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

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).

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. 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:

Current Thread