xsl-list
[Top] [All Lists]

RE: Expanding XML navigation

2004-09-21 08:58:09

I am trying to produce a fragment from a linkmap XML which 
will represent the linkmap as the user opens up particular 
pages in the hierarchy. SImilar in appearance to 
http://ecolore.leeds.ac.uk/xml/about/site.xml?> lang=en
I  use 
a page parameter to define which part will 
need its child element displayed.

Then I intend to process this new accurate piece of XML via 
another stylesheet in order to style it.

The problem I get is in preparing the first XML.

I have used copy-of, starting from the Current page, however 
this shows all the descendants and I only want to show its 
children I presume you can't use a predicate with it?

Then If I try using xsl:copy instead I am tying myself up in 
a mess. Any chance of some help?


You will need the identity transform with a no-op template:

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="x|y|z"/>

Where 'x' 'y' and 'z' are the names of the elements you don't want to
copy through.  Using your thought pattern this would be equivalent to
copy-of select with a predicate (which is of course not possible, as
copy-of select creates an exact copy).

Cheers
andrew