xsl-list
[Top] [All Lists]

Re: [xsl] XML-to-XML recursive template handling

2011-12-12 12:43:21
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(_at_)mulberrytech(_dot_)com
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
======================================================================

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

<Prev in Thread] Current Thread [Next in Thread>