This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
node()[last()] acts a little bit weird in MSXML3?
- To: "XSL-List" <XSL-List at mulberrytech dot com>
- Subject: node()[last()] acts a little bit weird in MSXML3?
- From: Patrik Höiem-Flyckt <patrik dot hoiem at hiq dot se>
- Date: Tue, 27 Jun 2000 18:12:08 +0200
- Organization: HiQ Väst AB
- Reply-To: xsl-list at mulberrytech dot com
Hi!
I have some excerpts of code below everything...
I'm working with MSXML3 (latest MSXML version) and have noticed that node()
doesn't seem to work, at least as I expect. It could be a misunderstanding
from my side or a combination with last() which complicates everything...
What I'm trying to do is selecting the last node inside a <p> tag and put a
<br/> after it, if it doesn't already exist a <br/> there.
Shouldn't p/node() apply to all nodes (including text nodes) inside p and
then last() just return the last one of them? Or does last() only apply to
element nodes and attribute nodes? If you look in the code below: Here I get
a <br/> after the last attribute inside the <p align="center">-tag (not what
I want) and a <br/> after the last element in the first <p> section (just
what I want). In the last <p> section which only contains one text node I
don't get any <br/> (not what I want).
Is it me or is it MSXML3 that's wrong - and if I'm wrong is there any good
documentation to enlighten me?
Regards /Patrik
Excerpt from the xsl file:
<xsl:template match="p/node()[last()]">
<xsl:if test="not(current()/following-sibling::*=br)">
<xsl:apply-templates select="*"/>
<br/>
</xsl:if>
</xsl:template>
Excerpt from the xml file:
<wml>
<card id="main" title="Flight info">
<p align="center">
Welcome to SWI
<input name="Input" type="text" title="Seats">
<value>1</value>
</input>
<select name="al" iname="ial">
<bo>Airline</bo>
<ivalue>2</ivalue>
<option>
<value>SK404</value>
<href>http://www.swi.se/airline?al=$(al)&id=<svar
name="Kalle"/></href>
<text>SK404 to <var name="Kalle"/></text>
</option>
<option>
<value>SK408</value>
<href>http://www.swi.se/airline?al=$(al)</href>
<text>SK408 to Västerås</text>
</option>
<option>
<value>SK412</value>
<text>SK412 to Copenhagen</text>
</option>
</select>
<link name="laban" type="access">
<href>http://www.swi.se/flight</href>
<text>Flights to <svar name="Kalle"/></text>
</link>
<link>
<href>http://www.swi/se/airport</href>
<text>Airports</text>
</link>
<a href="laban.xml">Laban</a>
</p>
<do type="accept" label="Go Home">
<go>
<href>http://www.swi.se</href>
</go>
</do>
</card>
<card id="help" title="Help info">
<p>
Help text
</p>
</card>
</wml>
*****************************
Patrik Höiem-Flyckt
HiQ Väst AB
Mob: +46 (701) 839181
Tel: +46 (31) 7439181
*****************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list