This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: fixed position
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] fixed position
- From: "Kevin Nardi" <kevnardi at hotmail dot com>
- Date: Wed, 01 Aug 2001 11:20:25 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
<xsl:template match="item">
<xsl:if test="position() = 4">
<xsl:text>Solution</xsl:text>
</xsl:if>
<xsl:if test="not(. = 'Solution')">
<xsl:value-of select="." />
</xsl:if>
 
</xsl:template>
This is a somewhat hokey way to do it, but if you can assume 1) That a
"Solution" node will ALWAYS show up in your data, and 2) There will ALWAYS
be four or more nodes, then it works fine.
Otherwise, you could copy a result tree fragment into a variable, and switch
the elements around so that Solution is 4th, and then iterate through that.
I know there must be a better way to do it, but I can't think of one right
now. Anyone else?
-Kevin
>From: James Melton <james.melton@cylogix.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: xsl-list@lists.mulberrytech.com
>Subject: Re: [xsl] fixed position
>Date: Wed, 01 Aug 2001 13:58:52 -0400
>
>The question is somewhat confusing. Are you putting out only text found
>inside an item element? If so are you imposing a particular order on all
>of the output? Are you only concerned with the ordering of "Solution"
>and nothing else? What if no "Solution" appears in the input? What if
>there are only three items, and "Solution" cannot be the fourth since
>there are not four?
>
>Jim.
>
>Meltem Kogelbauer wrote:
> >
> > Hi all
> >
> > here is an xml document
> > <data>
> > <item>Solution</item>
> > <item>Business</item>
> > <item>Strategy</item>
> > <item>Technology</item>
> > <item>Problem</item>
> > ...................
> > </data>
> >
> > the output will be as
> >
> > Business Strategy Technology Solution Problem ........
> >
> > the position of "Solution" may change in the xml file but it has to
>appear
> > in the 4th position always.
> >
> > Does anybody have a good idea for this?
> >
> > Thanks in advance
> >
> > Meltem
> >
> > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>--
>
>____________________________________________________________
>James Melton CyLogix
>609.750.5190 609.750.5100
>james.melton@cylogix.com www.cylogix.com
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list