Question: I am trying to apply a template on a ds (submodulesds) but i only want to render a certain set of nodes.
I can filter on the nodeset by id like this:

<xsl:apply-templates select="/data/submoduleds/entry[(@id = '10891')]" />

But i'd like to do this for multiple id's something like this:

<xsl:apply-templates select="/data/submoduleds/entry[(@id = '10891', '10892')]" />

I've tried all sorts of things like <xsl:apply-templates select="/data/submoduleds/entry[(@id = '10891', @id = '10892')]" /> but i can't get it working even after lot's of google search, so i hope anyone here can help me out.

<xsl:apply-templates select="/data/submoduleds/entry[@id = '10891' or @id = '10892']" />

wow, that was fast!
It's working. I'm pretty sure i tried that as well, but i must have missed something.

Next problem: I am trying to set the id's that i want to select dynamicly with a variable made out of a select box link field. But this seems not supported by xslt1 (might be wrong on this)

This is some simplified xml:

        <section id="1" handle="catalog">Catalog</section>
            <entry id="9580">
                <artikelnummer handle="1009930104m">10099301.04M</artikelnummer>
                <!-- selectbox link-->
                    <item id="10766" handle="1591108" section-handle="catalog" section-name="Catalog">1591108</item>
                    <item id="10768" handle="1591112" section-handle="catalog" section-name="Catalog">1591112</item>
                    <item id="10891" handle="1590080" section-handle="catalog" section-name="Catalog">1590080</item>
                    <item id="10892" handle="1590081" section-handle="catalog" section-name="Catalog">1590081</item>
                    <item id="11009" handle="1590216" section-handle="catalog" section-name="Catalog">1590216</item>
            <entry id="9581">
                <artikelnummer handle="1009930111m">10099301.11M</artikelnummer>
                <!-- selectbox link-->
                    <item id="10846" handle="1591232" section-handle="catalog" section-name="Catalog">1591232</item>
                    <item id="18679" handle="430dspt" section-handle="catalog" section-name="Catalog">430DSPT</item>

    <!-- datasource 'submodulesds' filtered by selectboxlink parameter output-->
        <section id="1" handle="catalog">Catalog</section>
            <entry id="18679">
                <artikelnummer handle="430dspt">430DSPT</artikelnummer>
            <entry id="11009">
                <artikelnummer handle="1590216">1590216</artikelnummer>
            <entry id="10892">
                <artikelnummer handle="1590081">1590081</artikelnummer>
            <entry id="10891">
                <artikelnummer handle="1590080">1590080</artikelnummer>
            <entry id="10846">
                <artikelnummer handle="1591232">1591232</artikelnummer>
            <entry id="10768">
                <artikelnummer handle="1591112">1591112</artikelnummer>
            <entry id="10766">
                <artikelnummer handle="1591108">1591108</artikelnummer>

What i am trying to do is render only the entries from the 'submoduleds' defined by the selectbox link field in the main ds (catalogds).
I'd try to do this by using this in my maintempate <xsl:apply-templates select="/data/submoduleds/entry[@id = '10891' or @id = '10892']" /> and then set the filter id's dynamicly (but that's not working)
I could get the same result with the subsectionmanager but i've got too many entries to use it (see this thread), so i am trying this alternative. But no luck so far as you can see.
If anyone could help me out on this one would be great!

I am not sure I understand what you mean. Maybe something like this?

<xsl:template match="catalogds/entry">
    <xsl:value-of select="title"/>
        <xsl:apply-templates select="/data/submoduleds/entry[@id = current()/submodules/item/@id]" />

<xsl:template match="submoduleds/entry">
        <xsl:value-of select="title"/>

on spot!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details