Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Does name exist

From: "tshad" <toms@----.--->
To: NULL
Date: 8/5/2009 11:18:00 AM
How would you test if something exists?

If you have:

    <FORM>
        <FIELDS>
            <HEADER>Subject Photo Page</HEADER>
            <TITLE1>This is Title1</TITLE1>
            <TITLE3>This is Title3</TITLE3>
        </FIELDS>
        <FORMPHOTOS>
            <PHOTO NUM="1">
                <FILENAME>09May001.jpg</FILENAME>
                <FILETYPE>JPEG</FILETYPE>
            </PHOTO>
            <PHOTO NUM="2">
                <FILENAME>09005.jpg</FILENAME>
                <FILETYPE>JPEG</FILETYPE>
            </PHOTO>
            <PHOTO NUM="3">
                <FILENAME>09002.jpg</FILENAME>
                <FILETYPE>JPEG</FILETYPE>
            </PHOTO>
        </FORMPHOTOS>
    </FORM>

And I want to test if a name exists:

Something like:

 <xsl:template match="FORMPHOTOS/PHOTO">
  <xsl:choose>
   <xsl:when test=". != ''">
    <attachment>
     <source>
        <xsl:choose>

         <xsl:when test="name() = concat('TITLE',current()/@NUM)   exists"> 
<--------

                    <xsl:value-of select="../../FIELDS/*[name() = 
concat('TITLE',current()/@NUM)]"/>
         </xsl:when>
         <xsl:otherwise>
                   <xsl:value-of select="../../FIELDS/HEADER"/>
         </xsl:otherwise>
        </xsl:choose>
     </source>
    </attachment>
   </xsl:when>
  </xsl:choose>
 </xsl:template>

What I want to happen here is that for the nodes that have NUM = 1 or 3 to 
use TITLE1 and TITLE3 (since they exist), otherwise use HEADER.

Thanks,

Tom 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent