[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] convert an attribute's value to a text node?


Subject: Re: [xsl] convert an attribute's value to a text node?
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 02 Dec 2002 15:14:37 -0500

Thanks to faithful David Carlisle for pointing out the answer
before I finally found it myself (by fgrepping saxon's source
code :-). The answer was: construct a node set as a new result
set.

<xsl:variable name="stringAsText">
  <xsl:value-of select="$string"/>
</xsl:variable>

As to David's and Joerg's question: what (the heck ;-) do I need
to convert strings to text nodes? Here is the answer: because
I am -- you guessed right -- throwing the text out for apply-
templates. To see more detail of my use case, refer to the
renewed regex (up-translation) thread (embryonic thread I should
say, for now there's only my message.)

Why am I not using call-templates etc? Because I never use
call-templates as a matter of policy, except for really
clear reasons, this not being one of them. I want to keep
my XSLT code as closely aligned to the "event pattern matching"
approach as possible. Whenever you may be using call-templates
I use apply-templates in a specific mode. Your "procedure"
metaphor is my use of a specific mode rather than a named
template. This keeps my code relatively flexible for change.

I am surprized how well I can still maintain this very dense
functional programming code of mine in XSLT. I rarely feel
that I am in the middle of a heap of ugly hacks and quick-fixes
(unless when I look at code that I wrote before I made my
policy decision against call-templates, and for-each, and
choose/when for that matter.)

regards
-Gunther




-- Gunther Schadow, M.D., Ph.D. gschadow@xxxxxxxxxxxxxxx Medical Information Scientist Regenstrief Institute for Health Care Adjunct Assistant Professor Indiana University School of Medicine tel:1(317)630-7960 http://aurora.regenstrief.org



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



Current Thread
Keywords