Subject: Re: [xsl] Position or Count From: Kevin_Gutch@xxxxxxxxxxx Date: Wed, 31 Oct 2001 14:52:44 -0500 |
Jenni, The call to the 'state-lookup' key DOES have to occur in the document holding the ROWSET elements. So your suggestion for using substring() function seems most viable. However, I am not sure how to go about doing it. Once I have written out the comma it is a text format. Not sure how I would then use substring? Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> To: Kevin_Gutch@xxxxxxxxxxx Sent by: cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx owner-xsl-list@xxxxxxxxxxxx Subject: Re: [xsl] Position or Count rytech.com 10/31/2001 01:38 PM Please respond to xsl-list Hi Kevin, > What I am trying to do is print the position number with a comma > until it is the last number which will then only print the number. > This has been easy enough in the past but I have a new wrinkle in my > code. With <xsl:if test="$layerExistence2 ='TRUE'"> only some layers > pass the test. So the result is mass confusion (on my part) for the > $Position variable determining if it is the last element or not. I > only want it to use elements that pass the test to determine > position. I'm not sure if I'm following the code correctly, but it looks as if you're trying to print the position of the layer_params element amongst other layer_params elements in the document, but only for certain of those layer_params elements. The easiest way to do something to all but the last of a list is to iterate over the list in order and pick out the last one. To do this, you need to be interested in all the items in the list. So what about only selecting those layer_params elements that fulfil the condition, and using xsl:number to number them? Something like: <xsl:for-each select="//layer_params [key('state-lookup', substring-after(../data_params/data_description_params /properties/property/@value, '
'))/EXIST = 'TRUE']"> <xsl:number level="any" /> <xsl:if test="position() != last()">,</xsl:if> </xsl:for-each> This won't work if the call to the 'state-lookup' key has to occur in the document holding the ROWSET elements rather than the document holding the layer_params element. If that's the case, I suggest always generating the comma, and then stripping the comma from the resulting string using the substring() function. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Position or Count, Jeni Tennison | Thread | Re: [xsl] Position or Count, Jeni Tennison |
RE: [xsl] Infinite Loop when trying, Christopher_Dant | Date | Re: [xsl] Position or Count, Jeni Tennison |
Month |