#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    27
    Rep Power
    0

    XSL filter not working


    Hi Guys,

    I'm trying to filter files to only "jsp" files.

    The lines that handle this is :

    Code:
    <!-- filter the task files to hide files that shouldn't be displayed -->
              <xsl:variable name="fileSet" select="$activeTask/Files/File[substring(Vpath,string-length(Vpath)-string-length('.dd') + 1,3) != '.dd']"/>
     
              <table cellpadding="0" cellspacing="0" border="0" class="file-table">
                <xsl:apply-templates select="$fileSet[contains(fileSet,'.jsp')]">
                  <xsl:sort select="Vpath"/>
                </xsl:apply-templates>
              </table>
    I think it is within apply-templates but what I have tried so far doesn't work. I suspect the contains() is appropriate to get desired result.

    Thanks for your help.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    27
    Rep Power
    0
    Tried below still not working with contains() and ends-width (may not work for me since i'm using xml version = 1, because I think this function uses version 2), anyone out there who can help me.

    Code:
    <!-- filter the task files to show 'jsp' files that should be displayed -->
              <xsl:variable name="fileSet" select="$activeTask/Files/File[substring(Vpath,string-length(Vpath)-4) = '.jpg']"/>
    
              <table cellpadding="0" cellspacing="0" border="0" class="file-table">
                <xsl:apply-templates select="$fileSet">
                  <xsl:sort select="Vpath"/>
                </xsl:apply-templates>
              </table>
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,238
    Rep Power
    9400
    Originally Posted by becool321
    (may not work for me since i'm using xml version = 1, because I think this function uses version 2)
    XPath 2, not XML.

    What are you using to apply the XSLT? I'm guessing Java?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    27
    Rep Power
    0
    I beleive its Java and yes I'm using XPATH version 1 not 2.
  8. #5
  9. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,238
    Rep Power
    9400
    Okay, so what library? Saxon? Xalan? WebSphere?
    Alternatively, what classes from what namespaces are you using?
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    27
    Rep Power
    0
    Thanks for replying and offer to help. However issue resolved, solution below:

    Code:
              <!-- filter the task files to show files that should be displayed -->
              <xsl:variable name="fileSet" select="$activeTask/Files/File[contains(Vpath,'.jsp')]"/>
    
              <table cellpadding="0" cellspacing="0" border="0" class="file-table">
                <xsl:apply-templates select="$fileSet">
                  <xsl:sort select="Vpath"/>
                </xsl:apply-templates>
              </table>

IMN logo majestic logo threadwatch logo seochat tools logo