Address Book allows you to set five types of phones that 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 the priority orders.

Example 7–13 displays the default code where Work phone is displayed as priority 1 and Home phone 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–14 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>
|