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

Re: XML-to-XML recursive template handling

Subject: Re: XML-to-XML recursive template handling
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 12 Dec 2011 13:43:18 -0500
Re:  XML-to-XML recursive template handling
Lynn,

On 12/11/2011 6:42 PM, Lynn Murdock wrote:
Yes, your solution worked, and that is what I was moving toward; I
just didn't quite know how to get there, and thought I needed to pass
a parameter into a called template to accomplish it. Thank you!

Glad to help.


I do have access to an XSLT 2.0 processor, and can probably modify
these stylesheets to use XSLT 2.0... For future reference, would you
mind explaining what the more graceful XSLT 2.0 solution would be?

Well in this case it wouldn't necessarily be a whole lot different. Instead of testing "normalize-space($result)" you could test, for example, "exists($result/fn)", which would be both more efficient for the processor, and more robust (as well as more intelligible to the maintenance programmer).


Or, instead, group them like so (into a single group):

<xsl:for-each-group select="$result/fn" group-by="true()">
  <fn-group>
    <xsl:sequence select="current-group()"/>
  </fn-group>
</xsl:for-each-group>

Or you could change your entire approach, and instead of processing the footnotes and then including your wrapper only conditionally (based on testing to see if there were any results), you could simply post-process your entire document to remove empty fn-group elements. This would be conceptually cleaner, and it will also scale better to more complex cases.

Cheers,
Wendell

======================================================================
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

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.