|
Subject:
|
Address use="HP"
|
|
Posted By:
|
Navy1991_1
|
Post Date:
|
7/2/2008 12:29:57 PM
|
I am trying to select a "HP" addr use code. Is there a way to select the specific use code, however if the specific use case is not there don't show anything? Would this be a "not" in the If statement?
XLST 2.0
XML CODE <addr use="HP"> <streetAddressLine>1 Done Ave.</streetAddressLine> <streetAddressLine>Suite #91</streetAddressLine> <city>New Market</city> <state>MD</state> <postalCode>21774</postalCode> </addr> <addr use="WP"> <streetAddressLine>337 Wellness Ave.</streetAddressLine> <streetAddressLine>Suite #9</streetAddressLine> <city>Silver Spring</city> <state>MD</state> <postalCode>20904</postalCode> </addr>
XSL CODE <td width='50%' align='left' valign="top"> <xsl:if test="./n1:assignedEntity/n1:addr[@use='HP']"> <xsl:call-template name="getAddress"> <xsl:with-param name="addr" select="./n1:assignedEntity/n1:addr"/> </xsl:call-template> </xsl:if> </td>
|
|
Reply By:
|
mhkay
|
Reply Date:
|
7/2/2008 2:40:55 PM
|
Your XSLT code does exactly that: if there is no @use attribute, the condition [@use='HP'] is false, so the named template is not called.
But perhaps I misunderstood your requirement?
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|