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

Re: Filtering problem

Subject: Re: Filtering problem
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 28 Jun 2006 09:59:08 +0530
Re:  Filtering problem
Hi Marcus,
 You can use "indentity transform" based stylesheet (as shown below)
conveniently, for creating filters:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" indent="yes" />

<!-- identity transform; copies everything -->
<xsl:template match="node() | @*">
  <xsl:copy>
      <xsl:apply-templates select="node() | @*" />
  </xsl:copy>
</xsl:template>

<!-- filter 1 -->
<xsl:template match="*[starts-with(name(@*), 'dim1')]" />

<!-- filter 2 ; a priority is attached, otherwise filter 1 and filter
2 rules gets ambiguous -->
<xsl:template match="*[@dim1_a = 'yes']" priority="3" />

</xsl:stylesheet>

Regards,
Mukul

On 6/28/06, Marcus Streets <marcus@xxxxxxxxxxx> wrote:
I have inherited some XML files that I need to filter.
Because i have inherited the files I did not design the way the elements
were tagged.
But I have to write the xsl to do the filtering - and I am only just
dipping my toe into xsl.

I want to output XML - that I will feed into FrameMaker for typesetting.

I want to filter on a number of dimensions.

For various hysterical reasons the various elements have been taged with
attributes of the form

<element dim1_a="yes">
or
<element dim1_a="yes" dim1_b="yes">

I want to create a filter that will include all elements where either:

there are no attributes starting dim1
or
dim1_a="yes"

And I need to do this for several dim1 dim2 etc.

If needs be I can run a number of xsl transforms one for each dimension.

I have some other attributes = e.g. role that I need to keep.

Is this possible, or do I need to completely change the way these files
are tagged.

If so can I easily do that with xsl - or do I need to do it by hand.

Thanks

Marcus

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-2007 All Rights Reserved.