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

RE: [xsl] from start tag A to end tag B

Subject: RE: [xsl] from start tag A to end tag B
From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx>
Date: Mon, 31 Jan 2005 17:25:02 +0100

That is perfectly what I was looking for.

Her is the final code with some adjustments to my real world case.
The only problem that I now have is that I get all the node inside
<textItem> in the opposite order. How can I prevent the xsl from doing

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

	<xsl:key name="x" match="node()"

	<xsl:template match="/ | @* | node()">
			<xsl:apply-templates select="@* | node()"/>

	<xsl:template match="attribute[@markup='yes']">

		<xsl:for-each select="p[@class='headline_04']">


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Montag, 31. Januar 2005 17:01
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] from start tag A to end tag B

> I do not understand how to do that.

jeni's site will explain how to use grouping based on "content" but in
your case the content is not a text string from element or attribute
content but rather the node identity of the nearest p node with a foo
class. generate-id returns a unique string for each node, so once you
have that string you just use the usual grouping idioms.

Note there are alternative mechanisms, eg Joris has just answered an
almost identical question in the parallel
Re: [xsl] Grouping immediate follow sibling
thread, giving two other strategies.

this works on your input:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:key name="x" match="root/node()"

<xsl:template match="root">
<xsl:for-each select="p[@class='foo']">
<xsl:copy-of select="key('x',generate-id())"/>


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread