Re: [xsl] Grouping - using Referenced Schema

Subject: Re: [xsl] Grouping - using Referenced Schema
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Mar 2007 11:17:52 -0400
Karthik,

Why not bind your namespaces to prefixes in the usual way and use them accordingly?

This doesn't appear to me to be about schemas as such, but only about the fact that your elements are in a namespace. So

<xsl:stylesheet xmlns:xys="http://ABC/XYZ"; xmlns:xyy="http://ABC/XYY";
  xmlns:qwe="http://ABC/QWE"; ...

...

<xsl:variable name="unique-countries" select="/xyz:cities/xyy:city[not(qwe:country=preceding-sibling::xyy:city/qwe:country)]/qwe:country"

(Though one would hope that each of these three element types would not be in its own peculiar namespace.)

The important point here is that the namespace prefixes don't have to be identical with those in the source documents as long as the namespace bindings themselves line up.

Are we missing something?

Cheers,
Wendell

At 10:50 AM 3/16/2007, you wrote:
Hi,

I am new to XSLT. I have to group based on a node.

The source schema is a referenced Schema hence I am using Qualified
Name in XPath.

In a normal scenario we will use like

<xsl:variable name="unique-countries"
select="//cities/city[not(country=preceding-sibling::city/country)]/country"
/>

If using referenced schema then how to use the preceding sibling ???

<xsl:variable name="unique-countries"
select="/*[local-name()='cities' and
namespace-uri()='http://ABC/XYZ']/[local-name()='city' and
namespace-uri()='http://ABC/XYY'][not(country=preceding-sibling::city/country)]/*[local-name()='country'
and namespace-uri()='http://ABC/QWE']" />


Thanks in advance


--
Thanks,
Karthik


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread