RE: [xsl] Combining two node Sets into one

Subject: RE: [xsl] Combining two node Sets into one
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 01 Apr 2005 15:17:09 -0500
Hi Chris,

At 12:47 PM 4/1/2005, you wrote:
Everything seems to be working good. (except the sort.. But I think I can
figure that out) However, when I assign the value to a variable and try to
use it later in my stylesheet..as I'm sure you know.. you cannot use most
xpath expression on a tree frag.

You can't query into *any* result tree fragment with an XPath, in unextended XSLT 1.0. The method of running successive transformations in a chain is available only if you pipeline stylesheets, use an extension function, or use XSLT 2.0.


But if you want help on this I'm afraid you'll have to be more explicit, with code samples.

Not fully understanding how your example actually works I can't figure out
how to wrap it so that the data creates my desired table.  If they would
only let me redo the xml. *sigh*.

It's true that the design of your input is pretty lame, but it's not the worst I've ever seen, and the transform really shouldn't be so bad.


But your question was regarding an XML->XML transform, where the target tag set has such elements as <Tamount> and so forth. There's no table there.

I take it you want either (a) to go now from the <Trans> elements into a table (HTML or FO or something else: you haven't said) or (b) to go straight from your source into a table, not into the <Trans> elements at all.

Either of these can be done, and neither goes beyond what's pretty easy to do in a single XSLT 1.0 transformation (no pipelining required).

Thanks for the help.. If you have time can you also explain at a high level
how wrapping an expression in an xml tag works to generate the combined
nodes.. Ie..

<xsl:template match="Damount">
  <Tamount>  <!---xml tag
        <xsl:apply-templates/>
  </Tamount>
</xsl:template>

Well, that's called a "literal result element". Rather than taking the time here to explain it, I'll leave you to the reference books and your favorite search engine to find.


Actually, in view of how basic this is, I'd recommend digging into some of the introductory literature on XSLT, on- or off-line, before posting again. Your questions here would all be answered by a good descriptive overview of the language, how templates work, what literal result elements are etc.

Cheers,
Wendell


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

Current Thread