Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 2nd, 2008, 12:29 PM
Authorized User
 
Join Date: Jun 2008
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Address use="HP"

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>
 
Old July 2nd, 2008, 02:40 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
hp exam stuff ? olango Need help with your homework? 1 September 23rd, 2006 06:47 PM
Need Assistance from HP Filter Experts... d_assassin ASP.NET 2.0 Basics 0 August 7th, 2006 02:40 AM
Need Assistance from HP Filter Experts... d_assassin Beginning PHP 0 August 2nd, 2006 10:54 PM
Reboot a HP/pc ezmee SQL Server DTS 1 June 28th, 2004 09:07 AM
Retreiving IP address & gateway address sjangit VBScript 0 February 3rd, 2004 02:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.