RE: [xsl] In-order traversal of XHTML of text() and <foo> nodes?

Subject: RE: [xsl] In-order traversal of XHTML of text() and <foo> nodes?
From: "Kaine Varley" <kaine.varley@xxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Mar 2003 16:17:37 -0000
Gan,

The following should give you the desired effect:

<xsl:template match="foobar">
	<P>
		<xsl:apply-templates />
	</P>
</xsl:template>


<xsl:template match="foo | bar">
	<B>
		<xsl:apply-templates />
	</B>
</xsl:template>


Kaine



-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Gan Uesli
Starling
Sent: 28 March 2003 3:49
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] In-order traversal of XHTML of text() and <foo> nodes?

Say I have XML like this...

<foobar>
   Once <foo>upon</foo> a midnight <bar>dreary</bar> while I...
</foobar>

How do I make a traversal of that <foobar> node, picking
up text(), <foo> and <bar> in document order, so as to pass
through the text() but apply separate templates to <foo>
and <bar>?

Really silly, but identical in concept, would be to output
XHTML like below...

<p>
   Once <b>upon</b> a midnight <i>dreary</i> while I...
</p>

I'm not really doing something that silly. But the example
illustrates my traversal confusion in the simplest possible
terms.

I can't just grab the whole <foobar> node. I need to traverse
it...with text() mixed in and between those <foo> and <bar>
nodes. Sentence structure must not be destoyed. It would be,
I think, like traversing an XHTML <p> node. XSL can do that,
yes?

Thanks,

Gan

-- 

  Mistera Sturno - Rarest Extinct Bird

  <(+)__       Gan Uesli Starling
   ((__/)=-    Kalamazoo, MI, USA
    `||`
     ++        http://starling.us


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



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


Current Thread