xsl-list
[Top] [All Lists]

xslt filtering question

2004-05-17 08:30:39
Hey, I'm having trouble writing an expression to match any occurance of
'w' in  a 'permission' attribute within a block of xml.  There can be
n-many 'fieldinfo' elements, and if any has a permissions attribute with a
'w' in it, I need to take one action, and another if there are no 'w's. 
In the code snippet below the xml block, the xpression im feeding
'contains' isnt properly written, I'm fairly new and having trouble with
it, any help would be appreciated.

<xml>
  <resultset>
    <resultinfo>
      <fieldinfo displayname="" name="userid" permissions=""/>
      <fieldinfo displayname="" name="username" permissions="rw"/>
      <fieldinfo displayname="" name="password" permissions="r"/>
      <fieldinfo displayname="" name="userlevel"permissions="rw"/>
    </resultinfo>
  ..
</xml>



<xsl:choose>
  <xsl:when
test="contains(/xml/resultset/resultinfo/fieldinfo/@permissions, 'w')">
    <a>
      <xsl:attribute name="href">http://url</xsl:attribute>
      Edit
    </a>
  </xsl:when>
  <xsl:otherwise> Edit </xsl:otherwise>
</xsl:choose>

---

David Kennedy
Program Manager, Alescere LLC.
630.968.8950 x311

Find us on the web at http://www.alescere.com




<Prev in Thread] Current Thread [Next in Thread>