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

Re: Re: [xslt transform & grouping] Using the Muenchia

Subject: Re: Re: [xslt transform & grouping] Using the Muenchian Method?
From: Anton Triest <anton@xxxxxxxx>
Date: Wed, 29 Sep 2004 15:17:33 +0200
identity xslt transform
Hi Michael,

If you just want to filter out some elements based on an attribute value,
you can combine the grouping and the filtering in one step, something like

<xsl:for-each select="Document/Article
   [count(.|key('by-info', @info)[1])=1 and not(@info='main')]">

That would give the same output, but without the Article elements that
have a info="main" attribute.

Given that your output completely reorganizes the document, I don't see
much use in an identity transform... Except of course if your Documents
element is part of a much larger input file, where you need a copy of the
file with only the Documents element modified. In such case, I guess you
could put the grouping/filtering template in filter.xslt.

I'm not sure why you include filter.xslt in base.xslt, and not the other way
around - then you have one "general" base.xslt that you can include in
any number of more "specialized" stylesheets?

Best regards,
Anton


Michael PG wrote:


Hello Anton,


Thanx for your help. That's exactly what I want!

What can I do regarding idenity transformation?
Today I work with two files, filter.xslt and base.xslt. I designed the filtering process from the begining so that Base.xslt does the identity transform, and Filter.xslt contains filtering rules.


Is it possible to make similar design with implementation of Muenchian method?

So the filtering work/grouping is done in the filter.xslt.

This is how I did it before:

base.xslt

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


<!-- import filter rules -->


<xsl:include href="filter.xslt"/>


<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>


    <xsl:template match="node() | @*">
         <xsl:copy>
              <xsl:apply-templates select="node() | @*"/>
         </xsl:copy>
    </xsl:template>

</xsl:stylesheet>


filter.xslt


<?xml version="1.0" encoding="UTF-8"?>


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="Article[not(@info='main')]"/>
</xsl:stylesheet>



Regards,


/M

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.