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

grouping in a separate data file

Subject: grouping in a separate data file
From: Andrew Kirkpatrick <andrew_kirkpatrick@xxxxxxxx>
Date: Sun, 29 May 2005 00:07:08 -0400
grouping and separate data
Hi,
I'm trying to use the muench method to group elements that exist in a
separate document that I reference in the key with document().  I can
make it work when the xsl document is directly transforming the XML
document (code 'a' below), but not when the xml document that is the
target of the grouping is a secondary document (see code 'b' below).

With the code b example, the parsing fails on the key - saying that the
xpath expression is invalid.  I've tried using a full URI and using the
second argument of the document function to set the URI reference, all
to no avail.

Any suggestions are appreciated. Thanks in advance.

CODE 'A' (this is test.xsl, parsing m.xml)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"/>

<xsl:key name="foo" match="check[not(@s508='')]" use="@g1"/>

<xsl:template match="standardsmatrix">
<html><head></head>
<body>
<p>
	Count: <xsl:value-of select="count(check[generate-id(.) =
generate-id(key('foo',@g1)[1])])"/><br />
	<xsl:for-each select="check[generate-id(.) =
generate-id(key('foo',@g1)[1])]">
		<xsl:value-of select="@g1"/><br />
	</xsl:for-each>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>



CODE 'B' (this is test.xsl, parsing test.xml and referring to m.xml via
document().)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"/>

<xsl:key name="foo"
match="document('m.xml')/standardsmatrix/check[not(@g1='')]" use="@g1"/>

<xsl:template match="report">
<html><head></head>
<body>
<p>
	Count: <xsl:value-of
select="count(document('m.xml')/standardsmatrix/check[generate-id(.) =
generate-id(key('foo',@g1)[1])])"/><br />
	<xsl:for-each
select="document('m.xml')/standardsmatrix/check[generate-id(.) =
generate-id(key('foo',@g1)[1])]">
		<xsl:value-of select="document('m.xml')/standardsmatrix/check/@g1"/><br />
	</xsl:for-each>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

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-2013 All Rights Reserved.