Re: [xsl] Process only nodes on a special axis

Subject: Re: [xsl] Process only nodes on a special axis
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 15 Aug 2006 16:15:08 -0400
Marco,

I'm unsure by what criteria you are determining what is an "outermost" element. The expression //element[not(preceding-sibling::element)] would get you the elements with keys 'Lichtausschnitt' and 'li' but not 're', but it would also get you '1,985', and it's not clear from your example why this one wouldn't (or would) be "outermost".

Clarify this and I'm sure someone will be able to help.

Cheers,
Wendell

At 02:56 PM 8/15/2006, you wrote:
Hi,

I have the following structure in my document:

<y-axis>
  <element>
    <key>1,985</key>
    <element>
      <key>Lichtausschnitt</key>
      <element>
        <key>li</key>
        <values>
          <value>
            <x>73,5</x>
            <y>7629</y>
          </value
        </values>
      </element>
      <element>
        <key>re</key>
        <values>
          <value>
            <x>81,0</x>
            <y>9282</y>
          </value
        </values>
      </element>
    </element>
    <element>
    ....
    </element>
  </element>
</y-axis>

Let the context node be element[parent::y-axis]. At this point I need to process only nodes on a special axis (I don't mean the XPath axes) to create some correct html output.

What I want/need is a XPath expression (or XSLT/XPath solution) that returns me only outermost nodes:
The element node with the key "Lichtausschnitt" and the element node with the key "li" but not the element node with the key "re".


This structure is created dynamically (elements can be of any depth) so I cannot use a fixed XPath expression. I tried to do this with a named template (which calls itself) but my problem is when I start calling it with

<xsl:call-template name="foobar">
  <xsl:with-param name="nodeSet" select="element[1]" />
</xsl:call-template>

I get the the complete element with the key "Lichtausschnitt" but I only want it with the child element with the key "li".

I hope that I could make my problem plain to you and you can give me a method of resolution.


Thanks in advance.



regards Marco

Current Thread