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

Re: More than one parameter for stylesheet

Subject: Re: More than one parameter for stylesheet
From: "Karl Koch" <TheRanger@xxxxxxx>
Date: Thu, 21 Jul 2005 19:01:54 +0200 (MEST)
mailmessage more than one from
Hello,

sorry the mismatching category name was my mistake. I wanted to simplify it
but only changed the upper part.

I think you helped me a lot in simplifying the stylesheet. As I said I am
not an expert and I kept that stylesheet because it worked. When I look at
your stylesheet, however, I have another question:

<xsl:param name="cat" select="'CAT1'"/>

  <xsl:template match="/">
       <bookshelf>
         <xsl:copy-of select="//*[*/category[@categoryid=$cat]/*"/>
       </bookshelf>
     </xsl:template>   

What does the first line exactly mean? As I mentioned before, I want to
insert the parameter via command line. So, why should I set it in the first
line to CAT1 (assuming that I want to insert CAT1 - CAT39 in the command
line)? I assume I would need something that assigs the parameter from the
commandline to the variable. How wouild this look like?

How would the command line look like since I would have two -IN parameters
(see my original posting)?

Many thanks for your help,
Karl

> --- Urspr|ngliche Nachricht ---
> Von: David Carlisle <davidc@xxxxxxxxx>
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re:  More than one parameter for stylesheet
> Datum: Thu, 21 Jul 2005 17:29:37 +0100
> 
> 
>    The stylesheet is here:
>    
>    <?xml version="1.0" encoding="UTF-8"?>
>    <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>    
>      <xsl:template match="/">
>        <bookshelf>
>          <xsl:apply-templates select="//category[@categoryid='CAT1']"/> 
>        </bookshelf>
>      </xsl:template>        
>    
>      <xsl:template match="category[@categoryid='FTUKSDIV3']">
>        <xsl:copy-of select="../../*"/>                
>      </xsl:template>    
>    </xsl:stylesheet>
>    
> 
> Is that really your stylesheet (with different  categoryid)? assuming
> you don't have nested categories, It seems very strange as it is
> written as the second template woul dbever be applied.
> 
> If you had      <xsl:template match="category[@categoryid='CAT1']">
> It would be applied but there is no need to go all teh way down and then
> come back up. 
> 
> Assuming that you did intend to have the same cataegory, apparently want
> to copy all the children of the grandparent of this category, so you
> don't want to apply templates at all, just:
> 
> 
> <xsl:param name="cat" select="'CAT1'"/>
> 
>   <xsl:template match="/">
>        <bookshelf>
>          <xsl:copy-of select="//*[*/category[@categoryid=$cat]/*"/> 
>        </bookshelf>
>      </xsl:template>        
> 
> although if you know how deep you need to go replacing //* by /a/b/c is
> likely to be a big improvement.
> 
> Having the parameter in a select rather than a match is good (because
> it's illegal to have parameters in a match, although i understand xalan
> doesn't enforce that) then you can set the param cat to any string on
> the command line (the -PARAM flag for xalan)
> 
> David
> 
> 
> 
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________
> 

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse fo?=r Mail, Message, More +++

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.