Xsl:if with dxl field values?

Hi xml profs,

I still struggling with the NotesXSLTransformer and the xslt.

Is it possible to create if clauses like:

If field value = “” do nothing

else write html code like field value

I know how to get field values:

<xsl:value-of select=“dxl:item[@name=‘fieldname’]/dxl:text”/>

and I read about dxl:if

<xsl:if test=“… = …”>

but I do not know how to combine it - I’m missing the syntax…

Thanks for an help in advance

UWe

Subject: xsl:if with dxl field values?

There’s a couple of ways you can do this. XSL doesn’t offer an if/then/else constuct, just a if/then construct. However, you can use xsl:choose/xsl:when/xsl:otherwise to accomplish this. Or, you can change your xsl:if to check to see if the field value != nothing and then include your td elements.

Subject: RE: xsl:if with dxl field values?

yes, that is exactly what I want to do:

<xsl:if test=“[value-of select=‘dxl:item[@name=‘fieldname’]/dxl:text’] = mycondition”>

myFieldValue

</xsl:if>

  • but this is just “my fantasy” about using the syntax, and surely will not work. I’m missing any documentation about dxl.

Uwe

I

Subject: RE: xsl:if with dxl field values?

So, are you saying you can’t get the xsl:if to work?

Have you tried it like this:

<xsl:if test=“dxl:item[@name=‘fieldname’]/dxl:text = ‘mycondition’”>

<xsl:value-of select=“dxl:item[@name=‘fieldname’]/dxl:text”/>

</xsl:if>

Subject: RE: xsl:if with dxl field values?

yes, if think I did - with no success

I now changed to:

<xsl:apply-templates select=“dxl:item[@name=‘MyFieldName’]”/>

…

<xsl:template match=“dxl:item”>

<xsl:if test = “./dxl:text = ‘mycondition’”>

… some html and dxl…

</xsl:if>

</xsl:template>

and this works fine :slight_smile:

thank you for your support!