xsl-list
[Top] [All Lists]

Re: Group various elements with empty tags (flat XML structure to hierarcial XML)

2005-01-07 11:55:21
For the first i suppose you should use

extension-element-prefixes ="sql" on the stylesheet declaration.


On Fri, 07 Jan 2005 13:45:53 -0500, M Glenties 
<mglenties(_at_)hotmail(_dot_)com> wrote:
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):
-------------------------------------
<ADDRESS>
     <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>
</ADDRESS>
MoosejawSaskatchewanTOEOPO
------------------------------------


To clear up António's question, the following is needed as David said:

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

but,

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

M Glenties.

From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Group various elements with empty tags (flat XML
structure to hierarcial XML)
Date: Fri, 7 Jan 2005 14:29:18 GMT

Yes, but isn´t 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.

David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


_________________________________________________________________
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*.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--