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

Re: Group various elements with empty tags (flat XML

Subject: Re: Group various elements with empty tags (flat XML structure to hierarcial XML)
From: "M Glenties" <mglenties@xxxxxxxxxxx>
Date: Fri, 07 Jan 2005 13:45:53 -0500
Thank you everyone for your posts.

The solution from Charles Knell is close to what I need. The output has 2 problems:

1. The attribute xmlns:sql="urn:schemas-microsoft-com:xml-sql" is now included with each element.
(FYI, the flat xml document I start with is created from an sql "for xml auto" command in a template file launched by VB).

2. The data grouped in the new tags repeats after the tag (except for the first element in the group).

For example, (snippet):
<street xmlns:sql="urn:schemas-microsoft-com:xml-sql">35 Main Street</street>
<city xmlns:sql="urn:schemas-microsoft-com:xml-sql">Moosejaw</city>
<country xmlns:sql="urn:schemas-microsoft-com:xml-sql"y>Saskatchewan</country>
<postal_code xmlns:sql="urn:schemas-microsoft-com:xml-sql">TOEOPO</postal_code>

To clear up Antsnio's question, the following is needed as David said:

<xsl:template match="id|type|count|language">
   <xsl:copy-of select="." />


the following does not produce output:
<xsl:template match="initial|lastname|city|country|postal_code|amount1|amount2|amount3" />

M Glenties.

From: David Carlisle <davidc@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Group various elements with empty tags (flat XML structure to hierarcial XML)
Date: Fri, 7 Jan 2005 14:29:18 GMT

> Yes, but isn4t that the default template beahviour?

No, the default templates never produce elements in the result, they
just recursively process the children meaning that a stylesheet with no
templates will extract all the text content of an xml file, discarding
any element markup.


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:

Powerful Parental Controls Let your child discover the best the Internet has to offer. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN. Premium right now and get the first two months FREE*.

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.