I don't use XSLT very much, but need to modify our current file.

Right now, we have the following statement:

<business_use>
  <xsl:value-of select="if (*:PersDriverInfo/*:kait_BusinessUseInd = '1') ))then 'Y' else 'N'"/>
</business_use>

I am trying to modify it to look at an additional node like this:

<business_use>
	<xsl:value-of select="if ((*:PersDriverInfo/*:kait_BusinessUseInd = '1') or (matches(*:VehUseCd,'BU|SR')))then 'Y' else 'N'"/>
</business_use>

However it is not working. The second conditional statement is taken from another part of the document, so I know it's logic is sound, but it is not producing the intended result. The resulting xml node stays set to 'N'.

As I said, I do not work with this stuff often, so perhaps I am making an obvious mistake, Any help would be appreciated.

Thanks!

Your syntax looks to be OK. The path to the matches node is probably incorrect.

First... I'm not an XSLT expert either.

Are you using some form of ACORD XML? PersDriverInfo and VehUseCd are both part of the standard but aren't children of the same parent which might be why it works in the other part of the document but not where you are trying to use it

To get to a (grand) parent they share you need to go up a few levels..

Here are the paths to those two nodes starting with a common ancestor (PersAutoLineBusiness)
PersAutoLineBusiness/PersDriver/PersDriverInfo
PersAutoLineBusiness/PersVeh/VehUseCd


I don't know if this sytax is correct but something like...

<business_use>
	<xsl:value-of select="if ((*:PersDriverInfo/*:kait_BusinessUseInd = '1') or (matches(*:../VehUseCd,'BU|SR')))then 'Y' else 'N'"/>
</business_use>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.