RE: [xsl] Attempting *not* to copy certain nodes

Subject: RE: [xsl] Attempting *not* to copy certain nodes
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Jan 2004 07:07:37 -0500
At 2004-01-14 21:31 -0500, 3rett 3onfield wrote:
Thank you for the wonderful guidance. I haven't been this pleased with anything programming-related in a very long time.
...
....and changed my XSLT to read...


--

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";
                exclude-result-prefixes="soap-env"
                version="1.0">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>

<xsl:template match="/">
  <xsl:apply-templates select="soap-env:Envelope/soap-env:Body/node()"/>
</xsl:template>

<xsl:template match="*"> <!--synthesize element with the input name-->
  <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

    <xsl:template match="/">
        <xsl:for-each select="MapSecuritiesResult/Security">

Right away I see you have two template rules for "/" ... your processor is probably not reporting this and using the acceptable (though not always to me) behaviour of using the last in document order of your stylesheet.


As a result, your first template rule for "/" is *not* being fired. Change the second to match the response element and see what happens.

So far I've been working so far through online tutorials, but I think some dead trees would do me good. Should I wait for new editions of the books listed in the FAQ (haven't seen anything in the FAQ or the archives about updates) or head over to the bookstore and buy what's on the shelves?

We have on our web site freely-downloadable previews of two XSL titles available as PDF files (perhaps an acceptable alternative to dead trees?):


  Practical Transformation Using XSLT and XPath
  (XSL Transformations and the XML Path Language)
  Tenth Edition - 2001-12-06 - ISBN 1-894049-08-X
  Copyright (c) 2001 Crane Softwrights Ltd.
  / 394 Pages / Subscription price includes free updates,   /
  /           / soft-copy of included examples, and an      /
  /           / accessible rendition and 10 PDF renditions. /
  /           / Free 140-page download preview excerpt.     /
  / Free prepaid copy for every U.S. Government employee.   /

  Practical Formatting Using XSL-FO
  (Extensible Stylesheet Language Formatting Objects)
  Fourth Edition - 2003-04-11 - ISBN 1-894049-11-X
  Copyright (c) 2003 Crane Softwrights Ltd.
  / 466 Pages / Subscription price includes free updates,   /
  /           / soft-copy of included examples, and an      /
  /           / accessible rendition and 10 PDF renditions. /
  /           / Free 242-page download preview excerpt.     /
  / Free prepaid copy for every U.S. Government employee.   /

I'm hoping to soon announce (after months of delays) the next edition of both books that will be free to all previous customers of the same title (we have a perpetual free update policy). The XSLT revision will be the last XSLT 1.0 revision, future free revisions will be on XSLT 2.0 (another benefit of not using dead trees).

I hope this helps.

......................... Ken

--
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-03-15
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

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-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:     http://XMLGuild.info
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread