样本密码强度规则

此示例 XSLT 规则确保密码长度至少为 8 个字符。


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:stsuuser="urn:ibm:names:ITFIM:1.0:stsuuser" version="1.0">

    <!-- Required to constrain output of rule evaluation -->
    <xsl:output method="xml" omit-xml-declaration="yes" encoding='UTF=8' indent="no"/>

    <!-- Need this to ensure default text node printing is off -->
    <xsl:template match="text()"></xsl:template>

    <!-- Let's make it easier by matching the constant part of our XML name -->
    <xsl:template match="/XMLUMI/stsuuser:STSUniversalUser/stsuuser:AttributeList">A
      <xsl:choose>
        <xsl:when test="string-length(stsuuser:Attribute
        [@name='password']/stsuuser:Value) >= 8">
          <valid>true</valid>
        </xsl:when>
        <xsl:otherwise>
          <valid>false</valid>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>

</xsl:stylesheet>