xsl-list
[Top] [All Lists]

RE: XSL Newbie seeks help

2005-02-08 17:47:08
Hi again,
I am obviously not so bright. I have tried to apply
many of the code samples, and keep getting an error
along the lines of "xsl:for-each-group not permitted at
this position in the XSL".

Here is what my xml looks like:
------------------------------
<Response>
<Record>
<Field FieldName="COUNTRY">France</Field>
<Field FieldName="COUNTRY">USA</Field>
<Field FieldName="HEADLINE">Blah, blah, blah</Field>
...More XML omitted goes here...
</Record>
</Response>

As mentioned, I used a simple xsl sheet that includes

<xsl:template match="Field">
  <xsl:apply-templates/>
<xsl:template>

(HTML omitted)

This results in a table with one row per Field. When
there is more than one instance of a field/attribute, I
would like to only have one row. So, in this case, I
would have "France, USA" on one row in my table instead
of across 2 rows.

I would appreciate a little direction if possible.

Thanks

JIM




On Tue, 8 Feb 2005 13:30:53 -0000, "Michael Kay" wrote:


Your problem is known as "grouping" and there is a
vast
literature on the
subject.

XSLT 2.0 has an instruction xsl:for-each-group to
handle the problem, and
the techniques you can use in XSLT 1.0 are explained
at
http://www.jenitennison.com/xslt/grouping

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: mylistaddress(_at_)canada(_dot_)com
[mailto:mylistaddress(_at_)canada(_dot_)com] 
Sent: 08 February 2005 13:15
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XSL Newbie seeks help

HI,
I searched the archives and must admit I am not sure
if
I found what I needed, as a lot of what I see is all
new to me.

I am successfully applying a very basic XSL sheet to
an
XML document using <xsl:template match="Field">
against
an XML document which has multiple "Field" nodes but
with different names, like this:

<Field FieldName="DOCID">abc1223</Field>
<Field FieldName="COUNTRY">USA</Field>
<Field FieldName="COUNTRY">Canada</Field>

This works great, but as you may have noticed, some
fields have the same FieldName attribute, and
sometimes
there can be a dozen countries, and this make my
transformed document (HTML table) much longer as it
creates a row for each COUNTRY entry.

How would I evaluate that there is more than one
occurance of the Field/FieldName combination so
that I
can create a concatenated list of contries so as to
display them all on only one row?

Any help appreciated.

Jim



--~------------------------------------------------------------------
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>
--~--

--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>