Hi,
I get a "Out of memory" error when I run a transformation using the xml
and xsl given below using xalan.
Is this a xalan version issue. Iam using the xalan that gets shipped with
jaxp-1.3.
Also if I replace
<xsl:apply-templates select="key('x',addressbook/address/zip)" />
with
<xsl:copy-of select="key('x',addressbook/address/zip)" />
I get xml with root starting with addressbook though the key is supposed to
match only "address" nodes.
Also, I get an extra set of address nodes complete with child nodes with
duplicates outside addressbook but inside keyNode.
Can someone explain whats going on.
Cheers,
Omprakash.V
"Michael Kay"
<mike(_at_)saxonic To:
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
a.com> cc: (bcc: omprakash.v/Polaris)
Subject: RE: [xsl] Question about
the key() function
05/14/2005
03:08 AM
Please
respond to
xsl-list
Because there is a bug in your XSLT processor. The correct output is:
Saxon 8.4 from Saxonica
...
<?xml version="1.0" encoding="UTF-8"?>
<keyNode>
<Name>1, Frisby, 48392</Name>
<Name>10, Backstayge, 02718</Name>
<Name>2, Attired, 00218</Name>
<Name>20, Backstayge, 02718</Name>
<Name>300, McGoon, 27318</Name>
<Name>31, Reckonwith, 02930</Name>
</keyNode>
The key() function is specified to remove duplicates, it appears your
implementation is not doing so.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: aspsa [mailto:aspsa(_at_)optonline(_dot_)net]
Sent: 13 May 2005 22:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Question about the key() function
Hi, folks.
Given this document...
<?xml version="1.0" encoding="UTF-8"?>
<addressbook>
<address>
<name>
<title>Mr.</title>
<first-name>Chester Hasbrouck</first-name>
<last-name>Frisby</last-name>
</name>
<street>1234 Main Street</street>
<city>Sheboygan</city>
<state>WI</state>
<zip>48392</zip>
<id>1</id>
</address>
<address>
<name>
<first-name>Mary</first-name>
<last-name>Backstayge</last-name>
</name>
<street>283 First Avenue</street>
<city>Skunk Haven</city>
<state>MA</state>
<zip>02718</zip>
<id>10</id>
</address>
<address>
<name>
<title>Ms.</title>
<first-name>Natalie</first-name>
<last-name>Attired</last-name>
</name>
<street>707 Breitling Way</street>
<city>Winter Harbor</city>
<state>ME</state>
<zip>00218</zip>
<id>2</id>
</address>
<address>
<name>
<first-name>Harry</first-name>
<last-name>Backstayge</last-name>
</name>
<street>283 First Avenue</street>
<city>Skunk Haven</city>
<state>MA</state>
<zip>02718</zip>
<id>20</id>
</address>
<address>
<name>
<first-name>Mary</first-name>
<last-name>McGoon</last-name>
</name>
<street>103 Bryant Street</street>
<city>Boylston</city>
<state>VA</state>
<zip>27318</zip>
<id>300</id>
</address>
<address>
<name>
<title>Ms.</title>
<first-name>Amanda</first-name>
<last-name>Reckonwith</last-name>
</name>
<street>930-A Chestnut Street</street>
<city>Lynn</city>
<state>MA</state>
<zip>02930</zip>
<id>31</id>
</address>
</addressbook>
...and this XSLT 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" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:key name="x" match="address" use="zip"/>
<xsl:template match="/">
<keyNode>
<xsl:apply-templates select="key('x',addressbook/address/zip)" />
</keyNode>
</xsl:template>
<xsl:template match="address">
<Name>
<xsl:value-of select="id"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="name/last-name"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="zip"/>
</Name>
</xsl:template>
</xsl:stylesheet>
...why does the output repeat nodes containing id values 10 and 20?
<?xml version="1.0" encoding="UTF-8"?>
<keyNode>
<Name>1, Frisby, 48392</Name>
<Name>10, Backstayge, 02718</Name>
<Name>10, Backstayge, 02718</Name>
<Name>2, Attired, 00218</Name>
<Name>20, Backstayge, 02718</Name>
<Name>20, Backstayge, 02718</Name>
<Name>300, McGoon, 27318</Name>
<Name>31, Reckonwith, 02930</Name>
</keyNode>
Respectfully,
ASP
--~------------------------------------------------------------------
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>
--~--
This e-Mail may contain proprietary and confidential information and is sent
for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--~------------------------------------------------------------------
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>
--~--