xsl-list
[Top] [All Lists]

RE: Attempting *not* to copy certain nodes

2004-01-15 18:20:11
Date: Thu, 15 Jan 2004 07:07:37 -0500
From: "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
Subject: RE: [xsl] Attempting *not* to copy certain nodes

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.

The reason why this isn't working makes sense to me. I attempted a few things I thought would match the response element and got nowhere. So I decided to run the first two templates without my third and got the following:

RequestError
No match found for this security identifier.
Header
7.90625
AA^

Success
0
0001099290
00371F206
AAC
ABLEAUCTIONS COM INC
AMEX

etc. (actually there were spaces between each line and also indenting, but I wanted to save space in mailreaders)

Is Saxon very different from Xalan or IE or Firebird? I tried to use the original code from http://www.biglist.com/lists/xsl-list/archives/200207/msg01649.html just to see why you got XML output using the above XSLT and I don't, but (perhaps because of semicolons and other characters added by the BigList archive), I got no output at all, just errors. Any ideas? At this point I'm just thoroughly confused.

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.

I think it will. Love the idea of learning XSLT without slaying any trees in the process.

Thanks for your help,

Brett


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