Subject: Re: [xsl] (or) statement in setting node-set variable From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Sat, 6 Jan 2001 10:43:08 +0000 |
Hi Keith, > <xsl:variable name="ReportList" > select="msxsl:node-set($ReportList-rtf)//GetMerchantReportList| > msxsl:node-set($ReportList-rtf)//GetLocationReportList"/> ?? I'm 90% sure that this does what you're trying to achieve. This is valid syntax if you want to set the $ReportList variable to a node set that results from the union of the GetMerchantReport elements and the GetLocationReportList elements in the node set generated by interpreting $ReportList-rtf as a node set. Alternative syntax for the select expression if that is what you want to achieve is: msxsl:node-set($ReportList-rtf)//*[self::GetMerchantReportList or self::GetLocationReportList] This collects all the node elements in the node set generated by interpreting $ReportList-rtf as a node set that are themselves GetMerchantReportList elements or GetLocationReportList elements. This is *probably* better in that the $ReportList-rtf result tree fragment only has to be converted to a node set once. [Aside: within a boolean context, like a predicate or a test on xsl:if or xsl:when, 'or' and the union operator '|' give the same functionality: if either of the node sets have any nodes in them, then the test will return true. I think it's slightly better to use 'or' because the processor can stop testing and return true if the first node set has any nodes in it, rather than having to construct two node sets every time.] Now you say that the content of this node set needs to depend on the value of some parameter in the stylesheet, and that you could be interested in only GetMerchantReportList items, in only GetLocationReportList items or in both. If the parameter gives the name of the elements that you're after, then you could use: msxsl:node-set($ReportList-rtf)//*[local-name() = $ElementName] If you need to test the parameter in other ways, then you could use something like: msxsl:node-set($ReportList-rtf)//* [self::GetMerchantReportList[...condition...] or self::GetLocationReportList[...condition...]] I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] (or) statement in setting, Mike Brown | Thread | [xsl] treat a string into a variabl, Pouliot, Brian R. |
Re: [xsl] variable value in "select, Mike Brown | Date | Re: [xsl] Finding the maximun numbe, Jeni Tennison |
Month |