Address Book allows you to set five types of phones which are defined in phoneEmailAndIM. The five definitions of 'phone' template are called and the priority value is passed to them when the values are displayed in the drop-down list. You can change their respective priority orders.
Example 7–14 shows the default code where Work is displayed as priority 1 and home is displayed as priority 2.
<option value="work"> <xsl:choose> <xsl:when test="$abperson"> <xsl:choose> <xsl:when test= "$abperson/phone[@priority = $priority]"> <xsl:if test= "$abperson/phone[@priority = $priority]/@type = 'work'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '1'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '1'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:text>_Work</xsl:text> </option> <option value="home"> <xsl:choose> <xsl:when test="$abperson"> <xsl:choose> <xsl:when test= "$abperson/phone[@priority = $priority]"> <xsl:if test= "$abperson/phone[@priority = $priority]/@type = 'home'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '2'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '2'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:text>_Home</xsl:text> </option> |
Example 7–15 shows how to change the code so that it displays Home phone as priority 1 and Work phone as priority 2.
<option value="work"> <xsl:choose> <xsl:when test="$abperson"> <xsl:choose> <xsl:when test="$abperson/phone[@priority = $priority]"> <xsl:if test= "$abperson/phone[@priority = $priority]/@type = 'work'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '2'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '2'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:text>_Work</xsl:text> </option> <option value="home"> <xsl:choose> <xsl:when test="$abperson"> <xsl:choose> <xsl:when test="$abperson/phone[@priority = $priority]"> <xsl:if test="$abperson/phone[@priority = $priority]/@type = 'home'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '1'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:if test="$priority = '1'"> <xsl:attribute name="selected"/> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:text>_Home</xsl:text> </option> |