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

RE: global filter

Subject: RE: global filter
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Aug 2013 16:21:17 +0200
RE:  global filter
Hi Lizzy,

thanks for your suggestions....

The whole idea of having the next-match in there was to deal with the parameter
it is more than just copying, and I don't want to add a pre processing filter.

But I realized that maybe I wanted to make things too beautiful...
and I keep forgetting that XSLT2 allows this

<xsl:template match="*[@audience = 'restricted' and not($audience = 'restricted')]" priority="25"/>

will likely be sufficient for my needs

Thanks

Geert



At 16:12 12/08/2013, you wrote:
I'd missed the part about wanting to switch this behavior on or off with a parameter. You can still use a general template for elements that are passed through when not filtered, for example:

<xsl:template match="*[@audience='restricted']" priority="10">
<xsl:if test="$restrictYN = 'N'"><xsl:copy-of select="."/></xsl:if>
</xsl:template>

Then you'll need to modify each template that does some work to add a test for @audience='restricted' and your parameter to either suppress the content or continue on as normal.

If it's an option for you, it might be easier to have a separate stylesheet filter out restricted elements run before your main stylesheet.

Vincent


-----Original Message----- From: Lizzi, Vincent Sent: Monday, August 12, 2013 9:48 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: global filter

Hi Geert,

This might work for you:

<xsl:template match="*[@audience='restricted']" priority="10"><!-- suppress --></xsl:template>

This should suppress any element with attribute audience='restricted'. Increase the priority if you have other templates that use priority 10.

Vincent


-----Original Message----- From: Geert Bormans [mailto:geert@xxxxxxxxxxxxxxxxxxx] Sent: Monday, August 12, 2013 9:36 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: global filter

Hi all,

Was wondering today if this would be the best approach...

I have an XML that could have an audience="restricted" on each an every element, and depending on a global parameter, I want to filter out all of the restricted content in my processing.

I would assume that if I had a common catch all template with a very high priority, the process would always go there first, and I only need one template with the filter logic.
next-match would then allow me to do the actual processing (if not restricted) Seems like a use case for next-match, no?


I could actually have the same effect more or less if I had only one template without a mode, and had all the other templates in a mode Is that correct, or am I overlooking something?

Just wondering what the best approach would be in a filter that is allowed on each and every element

Thanks

Geert

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.