RE: Param Element
You haven't said what the contents of the main input document are, nor what the supplied value of the parameter xm is. Without that, it's impossible for anyone to work out what this stylesheet does. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Karl Stubsjoen [mailto:kstubs@xxxxxxxxx] > Sent: 02 June 2005 22:43 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: Param Element > > Here is what I have, but not confident that it is working... it seems > that my check for uniqueness is failing, I get no results. Isn't it a > fair test to ask of a value it it exists in a set of values as I am > here: > <xsl:if test="$current_id = $activity_id"> > Where activity_id is a set of ID values as defined below.. > > <xsl:param name="xm" select="in_proc" /> > > <xsl:variable name="activity_id" select="in_proc/row/@id"/> > > <xsl:template match="/"> > <in_proc> > <xsl:apply-templates select="row"/> > <xsl:apply-templates select="$xm/row" mode="append"/> > </in_proc> > </xsl:template> > > <xsl:template match="row"> > <xsl:copy-of select="."/> > </xsl:template> > > <xsl:template match="row" mode="append"> > <xsl:variable name="current_id" select="@id"/> > <xsl:if test="$current_id = $activity_id"> > <xsl:copy-of select="."/> > </xsl:if> > </xsl:template> > > </xsl:stylesheet> > > > > On 6/2/05, David Carlisle <davidc@xxxxxxxxx> wrote: > > > > > One other dilemna: in order for the transformation to > not complain, I > > > have to do a select on my parameter declerations which looks like: > > > > > <xsl:param name="xm" select="/" /> > > > > If you pass in a value of this parameter then the select here is not > > used, it is just a default value in case no parameter is > supplied when > > the stylesheet is called. > > > > > > > > > But since the source is the exact same as the parameter > xml, how does > > > the select know which source to grab from? > > > > The select is always explictly into a specified node set > that node set > > will have nodes from one or more documents (usually just one). > > in this case, you have select="/" so that selects the root > node ancestor > > of the current node. If this is at the top level of teh > stylesheet the > > current node is the root node of the main input document, > so / selects > > that node. > > > > > Also, the above causes an > > > overflow when the below transformation is processed, > > > > most likely you have programmed an infinite loop, but it's > hard to say > > given the snippet you showed. > > > > > > > so would it be correct to express select as: select="in_proc"? > > That's also correct (but dofferent of course) but still if > you supply a > > value to this parameter when you run the program it doesn't > matter what > > select expression you use here. > > > > The templates that you show make no use of this parameter?? > > > > As written you will get a copy of the input doc except the top level > > element will be duplicated as you generate an in_proc element in the > > template for / and then apply templates to the child nodees > (which is > > the in_proc element in the source) which are copied. > > > > > > 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 > > > ______________________________________________________________ > __________
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format