Subject: RE: Empty tags From: Ben Robb <Ben@xxxxxxxxxx> Date: Thu, 19 Aug 1999 16:31:05 +0100 |
Your XML is not well formed - though this is probably just a typo...line 3 should read "<street_2></street_2>" or "<street_2/>" As for the XSL, you could use: <xsl:if test="street_2[.!='']"> <P>Street 2 : <xsl:value-of select="street_2"/></P> </xsl:if> Rgs, Ben Robb -----Original Message----- From: Minita Jha [mailto:jha@xxxxxxxxxxx] Sent: 19 August 1999 16:04 To: xsl-list@xxxxxxxxxxxxxxxx Subject: Empty tags Hi, How does one handle empty tags? For eg, consider the following xml: <address> <street_1>xxxx Drive</street_1> <street_2><street_2> <city>Bethesda</city> <state>MD</state> </address> Xsl: <xsl:template match="address"> <P>Street 1: <xsl:value-of select="street_1"/></P> <P>Street 2 : <xsl:value-of select="street_2"/></P> <P>City : <xsl:value-of select="city"/></P> <P>State : <xsl:value-of select="state"/></P> </xsl:template> In this case the header for street_2 is printed out. This is what I want to avoid. Thanks Minita. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Empty tags, Minita Jha | Thread | XML->ascii Conversion, Mitch Christensen |
Empty tags, Minita Jha | Date | Re: A Modest Proposal for the Re-in, Rick Geimer |
Month |