[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Selective output of half a tag?

Subject: Re: Selective output of half a tag?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 11 Jun 2002 14:37:33 +0100
xslt selective output
> to explain properly) above is to take a series of <foo/> tags

Try to avoid using the word "tag". If you think in terms of tags then
you get into precisely the problems you describe. XSLT does not deal
with tags at all, all tags (that is linerised XML markup)  have been
processed by an XML parser before XSLT even starts. XSLT works on trees
it does not see tags in teh input, nor can it directly create tags in
the output.

You can talk about a start tag without an end tag, as they are just
two strings but you can't have half a node in a tree. If you think in
terms of tree transformations then XSLT becomes a lot easier to

Your problem 

> Hence the need to determine if a <foo/> is the last in the group of
> <foo/>'s, so it can append a </mytag>.

No. wrong way to describe the problem. Your first description was

> take a series of <foo/> tags in the
> source, convert them all to <bar/> in the output, and then wrap the
> group of <bar/> up in <mytag/>.

but again you should not think in terms of tags

take a series of foo eleemnts in the
source, convert them all to bar elements in the output, and then wrap the
group of bar up in mytag element:

<xsl:template match="parent-of-foo">
 <xsl:template select="foo"/>

<xsl:template match="foo">


This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.