[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Lynn,
On 12/11/2011 6:42 PM, Lynn Murdock wrote:
Glad to help.
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):
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.
Re: [xsl] XML-to-XML recursive template handling
Subject: Re: [xsl] XML-to-XML recursive template handling From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 12 Dec 2011 13:43:18 -0500 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XML-to-XML recursive template, Lynn Murdock | Thread | [xsl] mode question, Roelof Wobben |
Re: [xsl] problem with a example of, Michel Hendriksen | Date | [xsl] What problem are you trying t, Wendell Piez |
Month |