xsl-list
[Top] [All Lists]

apply-templates - A doubt.

2003-04-13 22:42:07
Hello,

I am looking for a method to overcome my problem. Thanks for your help.

I have an xml a.xml file like this:

        <?xml version="1.0"?> // root
        <?xml-stylesheet type="text/xsl" href="a.xsl"?>
        <first>
        <puid>abc</puid>
        <suid>123<suid/>
        <suid>456<suid/>
        </first>

For this I have a stylesheet like this:
        <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="first">
        <html>
        <body>
        <i>puids:</i><br/>
        <xsl:apply-templates select="puid"/><br/>
        <i>suids:</i><br/>
        <xsl:apply-templates select="suid"/><br/>
        </body>
        </xsl:template>

        <xsl:template match="puid">
        <xsl:value-of select="."/>
        </xsl:template>

        <xsl:template match="suid">
        <xsl:value-of select="."/>
        </xsl:template>


Now, the question is
        
It is possible that, my xml file sometime does not contain any suid. In this
case, i should not even print the suids: heading also. I cannot put this
within the template match since
it will be printed then for each suid. 

How do I overcome this problem?

Please help me in solving this problem,
Regards,
Thanks,
Nirmala


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • apply-templates - A doubt., Nirmala R <=