Subject: Re: [xsl] Value of <id> element not returned From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 04 Apr 2005 13:19:38 -0400 |
Cheers, Wendell
Hi, folks.
I have the following stylesheet.
============================================================================ === <?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="/"> <root> <countMethod> <xsl:apply-templates mode="item-detail" select="addressbook/address[count(. | key('x', zip)[1])=1]"/> </countMethod> </root> </xsl:template>
<xsl:template match="address" mode="item-detail"> <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>
Here's a snippet of the XML document to be transformed.
<?xml version="1.0" encoding="UTF-8"?> <addressbook> <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> ... (etc) ... ============================================================================ ===
For some reason the value of <id> is not returned. Here's the output, as it reflects the entire XML source document.
<?xml version="1.0" encoding="UTF-8"?> <root> <countMethod> <Name>, Frisby, 48392</Name> <Name>, Backstayge, 02718</Name> <Name>, Attired, 00218</Name> <Name>, McGoon, 27318</Name> <Name>, Reckonwith, 02930</Name> </countMethod> </root>
Does anyone know why the <id> element values are not returned?
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Value of <id> element not ret, aspsa | Thread | RE: [xsl] Value of <id> element not, aspsa |
Re: [xsl] xsl: preserving spaces p, josh higgins | Date | Re: [xsl] Testing 2 XML documents f, Mukul Gandhi |
Month |