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

Re: producing three sets of output from one file

Subject: Re: producing three sets of output from one file
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Fri, 29 Mar 2002 18:23:07 +0100
audience stylesheet group microsoft.public.sharepo
Hello Eric,

I think it's not so difficult. In any case you need to parameterize the
stylesheet:

<xsl:stylesheet>
    <xsl:param name="audience" select="'A'"/>

    <xsl:template match="root">
        <xsl:apply-templates select="article"/>
    </xsl:template>

    <xsl:template match="article">
        <!-- .... -->
    </xsl:template>
</xsl:stylesheet>

Now you have to compare the level of $audience with the @audience of the
articles. With characters this is a bit difficult, with numbers quite easy.
So, if you can replace A with 1 and B with 2 and so on, the following will
help:

<xsl:stylesheet>
    <xsl:param name="audience" select="'1'"/>

    <xsl:template match="root">
        <xsl:apply-templates select="article[@audience &lt;= $audience]"/>
    </xsl:template>

    <xsl:template match="article">
        <!-- .... -->
    </xsl:template>
</xsl:stylesheet>

When using ABC, you have to do the replacing dynamically:

    <xsl:apply-templates select="article[translate(@audience,'ABC','123')
&lt;= translate($audience,'ABC','123')]"/>

Hope this helps,

Joerg

> I'm trying produce three sets of output from one set of data, each of
> which are subsets of the preceding.  That is, I have:
>     <article audience="A">stuff here</article>
>     <article audience="B">stuff here</article>
>     <article audience="C">stuff here</article>
>     <article audience="A">stuff here</article>
>     <article audience="A">stuff here</article>
>
> For audience A, I want to include only the A articles; for audience B, I
> want to include both A&B articles, and for audience C, I want to include
> them all. I was preparing to just create three different XSL files and
> then use Instant Saxon to transform with each XSL. However, since the
> output is formatted identically, I suspect there's a much more elegant
> way to do it (perhaps passing some parameter when compiling?), but I'm
> not sure what I would do.
>
> If this is explainable to a beginner, I'd appreciate any help.  (Or if
> this is beyond a beginner's ability, I'd appreciate someone telling me
> that... and I'll do the easy three files as I planned and come back to
> this at some point in the future.)
>
> Thanks,
> Eric


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.