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

Grouping with keys

Subject: Grouping with keys
From: "Silvia Liberto" <SLiberto@xxxxxx>
Date: Fri, 3 Feb 2006 17:10:02 +0100 (MET)
silvia liberto
Hello all,

i have a grouping problem.
I want to group in this example p with val="Heading1" and p with
val="Programlisting".
I have problems with the programlisting, i think my "match" is not correct.
I4ve tried several things but nothing works, have someone an idea what4s
wrong!?

Thanx
Silvia

here is my code:

xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<wordDocument>
	<body>
		<sect>
			<p>
				<pPr>
					<pStyle val="Heading1"/>
				</pPr>
				<r>
					<t>Erste Ueberschrift</t>
				</r>
			</p>
			<p>
				<pPr>
					<pStyle val="Programlisting"/>
				</pPr>
				<r>
					<t>&lt;HTML&gt;</t>
				</r>
			</p>
			<p>
				<pPr>
					<pStyle val="Programlisting"/>
				</pPr>
				<r>
					<t> &lt;HEAD&gt;</t>
				</r>
			</p>	
		</sect>
	</body>
</wordDocument>


Xslt:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:key name="heading" match="wordDorcument/body/sect/p"
use="generate-id((preceding-sibling::p[pPr/pStyle/@val='Heading1'" />
<xsl:key name="prog" match="pPr/pStyle/@val='Programlisting'"
use="generate-id((preceding-sibling::p[pPr/pStyle/@val='Programlisting'" />

 <xsl:template match="p">
 <xsl:choose>			
		<xsl:when test="pPr/pStyle/@val='Heading1'">
			<title>
				<xsl:value-of select="r/t"/>
			</title>
		</xsl:when>
		<xsl:when test="pPr/pStyle/@val='Programlisting'">
		<programlisting>
			 <xsl:for-each select="key('prog',generate-id())">
				<xsl:value-of select="r/t"/>
			 </xsl:for-each>	 
		</programlisting>
		</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>





-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse f|r Mail, Message, More +++

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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-2011 All Rights Reserved.