|
Subject: Re: [xsl] Grouping with keys or xpath From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 05 Oct 2002 21:54:19 -0400 |
I only want to group each articlerow in one variant at time.
Any hint/help would be appreciated
T:\ftemp>type ulf.xml <doc> <variant> <articlerow> <nev_article_pos>1</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>12</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>12</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <parttitle>Hello World</parttitle> <articlerow> <nev_article_pos>18</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>19</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>19</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> </variant> <variant> <articlerow> <nev_article_pos>4</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <parttitle>Hello World</parttitle> <articlerow> <nev_article_pos>6</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>4</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>18</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>19</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> <articlerow> <nev_article_pos>19</nev_article_pos> <article> <nev_article>009504145</nev_article> </article> </articlerow> </variant> </doc>
T:\ftemp>type ulf.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="doc">
<document>
<partinfo>
<xsl:for-each select="variant">
<partlist>
<xsl:variable name="articlerows" select="articlerow"/>
<xsl:for-each select="$articlerows | parttitle">
<xsl:if test="self::parttitle">
<title><xsl:value-of select="."/></title>
</xsl:if>
<xsl:if test="generate-id(.)=
generate-id($articlerows[nev_article_pos=
current()/nev_article_pos])">
<partcallout>
<calloutitem>
<xsl:value-of select="nev_article_pos"/>
<xsl:for-each select="$articlerows[nev_article_pos=
current()/nev_article_pos]">
<article>
<xsl:value-of select="article/nev_article"/>
</article>
</xsl:for-each>
</calloutitem>
</partcallout>
</xsl:if>
</xsl:for-each>
</partlist>
</xsl:for-each>
</partinfo>
</document>
</xsl:template>T:\ftemp>type ulf.out <?xml version="1.0" encoding="utf-8"?> <document> <partinfo> <partlist> <partcallout> <calloutitem>1<article>009504145</article> </calloutitem> </partcallout> <partcallout> <calloutitem>12<article>009504145</article> <article>009504145</article> </calloutitem> </partcallout> <title>Hello World</title> <partcallout> <calloutitem>18<article>009504145</article> </calloutitem> </partcallout> <partcallout> <calloutitem>19<article>009504145</article> <article>009504145</article> </calloutitem> </partcallout> </partlist> <partlist> <partcallout> <calloutitem>4<article>009504145</article> <article>009504145</article> </calloutitem> </partcallout> <title>Hello World</title> <partcallout> <calloutitem>6<article>009504145</article> </calloutitem> </partcallout> <partcallout> <calloutitem>18<article>009504145</article> </calloutitem> </partcallout> <partcallout> <calloutitem>19<article>009504145</article> <article>009504145</article> </calloutitem> </partcallout> </partlist> </partinfo> </document>
-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-10-1 Practical Formatting Using XSL-FO Next public training: 2002-12-08,2003-02-03,06,03-03,06
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Grouping with keys or xpa, Michael Kay | Thread | RE: [xsl] Grouping with keys or xpa, TSchutzerWeissmann |
| RE: [xsl] processin each element no, Michael Kay | Date | [xsl] generating numbers for anchor, Simeon Walker |
| Month |