View Single Post
 
Old September 1st, 2006, 09:17 AM
NEO1976 NEO1976 is offline
Friend of Wrox
 
Join Date: May 2005
Location: Nürnberg/München, , Germany.
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to control optional elements and attributes

Dear all,

Sorry that I am asking many questions today but unfortunately I have another problem.

I am having two optional attributes and they are giving me source and image link of the external icons. I am gonna write down the XSL again but if you want to see the XML file it is the same XML at the loop in XSL topic

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fcs="urn:factiva:developer:v3_0:parsers" xmlns:msxsl="urn:schemas-microsoft-com:xslt" >
<xsl:output method="html" version="4.0" />
<xsl:template match ="/">
<xsl:apply-templates select="SOAP-ENV:Envelope/SOAP-ENV:Body/fcs:GetArticleResponse/fcs:articleResponse/fcs:articleResultSet/fcs:article"></xsl:apply-templates>
</xsl:template>
<xsl:template match="SOAP-ENV:Envelope/SOAP-ENV:Body/fcs:GetArticleResponse/fcs:articleResponse/fcs:articleResultSet/fcs:article">
    <head>
            <title>Factiva Test</title>
            <link href='http://intranet1-t.internal.epo.org/portal/themes/html/epoIntranetCD/cssTheme.css' rel="stylesheet" type="text/css" />
            <link href='http://intranet1-t.internal.epo.org/portal/themes/html/epoIntranetCD/cssPageBody.css' rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="epoContentStandard">
        <img src="http://dg1-2.internal.epo.org/_test/Huerol/Factiva/flogostyle1.gif" align="right" />
        <br clear="all"/>
     <xsl:if test="fcs:logo/@source != ''">
        <xsl:variable name="logosource" select="fcs:logo/@source"/>
        <xsl:variable name="logoimage" select="fcs:logo/@image"/>
        <xsl:variable name="logo" select="'fcs:logo/@source'+'/'+'$logoimage'"/>
        <img src= "$logo"/>
        </xsl:if>
         <h1 style="margin-bottom:0.3ex;"><xsl:value-of select="fcs:headline/fcs:paragraph"/></h1>
        <p style="margin-bottom:3.5ex;font-size:80%;color:#888888;"><xsl:value-of select="fcs:copyright"/></p>
    <xsl:apply-templates select="//fcs:leadParagraph"/>
    <xsl:apply-templates select="//fcs:tailParagraphs"/>
    <div id="epoFooter">
    <a href='http://www.factiva.com/termsofuse'>Terms of use</a>&nbsp; &copy;200X Dow Jones Reuters Business Interactive LLC (trading as Factiva). All rights reserved.
    </div>
        </div>
    </body>
</xsl:template>
<xsl:template match="fcs:leadParagraph">
    <p><strong>
     <xsl:apply-templates select="fcs:paragraph"/>
     </strong>
    </p>
</xsl:template>
<xsl:template match="fcs:tailParagraphs">
    <p>
     <xsl:apply-templates select="fcs:paragraph"/>
    </p>
</xsl:template>

<xsl:template match="fcs:paragraph">
     <p>
        <xsl:value-of select="."/>
     </p>
</xsl:template>

</xsl:stylesheet>

1) What should I write in xsl:if statement
2) How can I add 2 variable with "/" to get a logo variable for img src?


Your attitude determines your altitude
__________________
Your attitude determines your altitude