Re: [xsl] Template matching preceding-sibling.

Subject: Re: [xsl] Template matching preceding-sibling.
From: "Ilya Konanykhin" <ilya.konanykhin.ml@xxxxxxxxx>
Date: Sat, 17 Nov 2007 10:40:43 +0600
Wendell

No insult is taken, at least not by me.

I wouldn't go that far (at least I didn't take your message to mean you were blaming anyone)

I'm really glad to know that, thank you :)


Right. One way of addressing this is to show us exact code with input and results (pasted please) in minimal form and also tell us what processor you're running. There are list readers who run several different processors in order to check exactly this kind of thing, and can confirm what you're seeing or help to analyze relevant factors if they can't. Also, we can collectively establish quite quickly what a processor should be doing in a given specific case -- that is, the relevant expertise is available to expose mistaken assumptions and even reasonable but incorrect interpretations.

The funniest thing is, that in my very first post I did include all inputs and
outputs, copy-pasted. But all XSLT-related responses I got so far were
about this "...[... != ...]" expression - I guess that's because members
immediately spot this commonly misunderstood expression and suppose
it is the problem I'm addressing, without reading attentively my whole message
(and Michael Key's response is an obvious cue of this).


Just in case if somebody is still interested in this issue I'll quote here this
message, but personally, now I almost 100% sure that it's ok and the input
is transformed correctly with this template.


Date: Wed, 14 Nov 2007 10:00:53 +0600
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "Ilya Konanykhin" <ilya.konanykhin.ml@xxxxxxxxx>
Subject: Re: [xsl] Template matching preceding-sibling.
Message-ID: <00a701c82672$f52f63b0$0200a8c0@KRYGER>

Hi, list!
I'm asking for clarification of the topic being on the list several days ago (Nov 8). Steve <subsume@xxxxxxxxx> wrote:


I'm missing something fundamental, what is it?

<xsl:template match="Rec[activity != preceding-sibling::Rec/activity
or not(preceding-sibling::Rec)]">
 Ello xslers.
</xsl:template>

<xml>
   <Rec>
     <activity>hi</activity>
   </Rec>
   <Rec>
      <activity>hi</activity>
   </Rec>
</xml>

----

Above should only print anything once, but I'm getting it each time.
What am I not getting?

Charles Knell and Scott Trenda gave advices/made notices, thus confirming, that the problem exists. But copying the input data and the template given by Steve and running it I obtained exactly the result required by him in the first topic-forming message, if I understood his request correctly. I used MSXML (not sure about version, but don't think it's important in this simple case) and Saxon 9, for the latter I also tried changing template version to 2.0 - the result stood the same. Data follows:


-----------
input.xml:
<?xml version="1.0"?>

<xml>
  <Rec>
    <activity>hi</activity>
  </Rec>
  <Rec>
     <activity>hi</activity>
  </Rec>
</xml>

-----------
input.xsl:
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:template match="Rec[activity != preceding-sibling::Rec/activity
or not(preceding-sibling::Rec)]">
 Ello xslers.
</xsl:template>

</xsl:stylesheet>

-----------
output.xml:
<?xml version="1.0" encoding="UTF-8"?>

Ello xslers.

hi

-----------

As it is clearly seen the string "Ello xslers" appears only once and not twice as Steve wrote ("hi" comes from the defaul copy rules, as I understand it).

Did I missed or misunderstood something very basic? Can someone please reveal the trick to me (especially interested in Charles' oppinion as he was involved most intensively in the discussion).

Many thanks in advance,
Ilya

Cheers,
Ilya


Current Thread