Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Profiterole 232 posts 264 karma points
    Jan 12, 2011 @ 02:35
    Profiterole
    0

    Select nodes that match one or more words

    Hi guys, I have a (probably simple) problem with my xslt (legacy mode).

    Here's my code :

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node[data [@alias = 'teacherSubject'] = $subjectChoosen]">

    Each teachers teach one or more subject. Maths, or Maths and Sciences for instance. I'd like to display only nodes with Maths in it. But I want to display every nodes with Maths in it even if there's another subject with it.

    So, in my example $subjectChoosen = Maths, but for now it only displays the Maths only teachers and not the Maths and sciences teachers even if there is Maths in the teacherSubject parameter.

    Do you understant my question?

    Thank you!

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 12, 2011 @ 03:27
    Tom Fulton
    0

    Hi,

    What does teacherSubject look like?  Is it a delimited string?

    Maybe something with the contains() function? (not tested)

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [contains(data [@alias = 'teacherSubject'], $subjectChoosen)]">

    In this case you might consider delimiting like ',Math,Science,' and search for ',Math,' so no partials are accidentally returned.

    Let us know if this works for you..

    -Tom

  • Profiterole 232 posts 264 karma points
    Jan 12, 2011 @ 14:11
    Profiterole
    0

    I, thank you for your reply. In the macro parameter, it's a string. But in the my docType it's defined by checkbox. I'll try with the contains.

  • Profiterole 232 posts 264 karma points
    Jan 12, 2011 @ 14:14
    Profiterole
    0

    Thank you, it worked with contains.

Please Sign in or register to post replies

Write your reply to:

Draft