views:

520

answers:

2

Thanks to this post I've come up with the following template:-

<xsl:variable name="Doc">
  <xsl:call-template name="OuterTemplate.GetTitle">
    <xsl:with-param name="Title" select="@DocumentLink1"/>
  </xsl:call-template>
</xsl:variable>

<a href="{substring-before($Doc,',')}">
  <xsl:value-of select="substring-after($Doc,',')" />
</a>

This template is nested in an unorderd list and li tag (see below). Since this code has a physical and visual presence in the html page when no content exists I would like to add the li tags and possibly the ul tags to the template. Can anyone tell me how to accomplish this?

<ul>
<li>
    <xsl:variable name="Doc">
        <xsl:call-template name="OuterTemplate.GetTitle">
            <xsl:with-param name="Title" select="@DocumentLink1"/>
        </xsl:call-template>
    </xsl:variable>
<a href="{substring-before($Doc,',')}">
    <xsl:value-of select="substring-after($Doc,',')"/>
</a>
</li>
<li>
<xsl:variable name="Doc">
        <xsl:call-template name="OuterTemplate.GetTitle">
            <xsl:with-param name="Title" select="@DocumentLink2"/>
        </xsl:call-template>
    </xsl:variable>
<a href="{substring-before($Doc,',')}">
 <xsl:value-of select="substring-after($Doc,',')"/>
</a>
</li>
<li>
<xsl:variable name="Doc">
        <xsl:call-template name="OuterTemplate.GetTitle">
            <xsl:with-param name="Title" select="@DocumentLink3"/>
        </xsl:call-template>
    </xsl:variable>
<a href="{substring-before($Doc,',')}">
    <xsl:value-of select="substring-after($Doc,',')"/>
</a>
</li>

+1  A: 

I'm assuming from your link to the other post that you are using the Content Query Web Part here.

You need to wrap your call to this variable using XSLT header/footer techniques. Here is one of a few posts I've seen that show how this can be done with the CQWP in particular.

Alex Angas
A: 

You could try using the xsl:if elements to conditionally output content. You can find more info on how xsl:if works @ http://www.w3schools.com/xsl/xsl_if.asp or just use your favorite search engine.

Waldek Mastykarz - MOSS MVP
I'm quite stuck on what test to use?
toomanyairmiles