Jump to content

xsl:if and checking array


krokkodillo
 Share

Recommended Posts

Hi guys! I'm newbie in XSLT, so please bear with me. I've problem how to implement if statement where i could check plenty of exclusions in one line instead of writing all of them in line. First what I did was to put exclusion list in to XML that stylesheet is working on:

<?xml version="1.0" encoding="UTF-8"?><!--exception list item = conceptitem !--><exceptions>	<item>		<conceptName>concept1</conceptName>	</item>	<item>		<conceptName>concept2</conceptName>	</item></exceptions>

Here is the code for calling the template:

 			<xsl:variable name="res" as="element()*">				<bri:concept taxonomy="{$taxonomyKeyA}" ignorecontext="true" select="self::*[not(@name = 'hypercubeItem' or @name = 'dimensionItem')]"> 					<xsl:call-template name="checkDuplicates">						<xsl:with-param name="input" select="@name"/>					</xsl:call-template>

And the "checkDuplicates" template:

<xsl:template name="checkDuplicates" match="exceptions/item">		<xsl:param name="input" required="yes" as="xs:string"/> 		<xsl:variable name="tes" as="xs:string ?">			<xsl:for-each select="conceptName">				<xsl:variable name="item" as="xs:string">					<xsl:value-of select="."/>				</xsl:variable> 				<xsl:message> Item: <xsl:value-of select="$item"/>				</xsl:message> 				<xsl:if test="$input = $item">					<xsl:text>duplicate!</xsl:text>				</xsl:if>			</xsl:for-each>		</xsl:variable>	</xsl:template>

So the question is why xsl:message Item inside the xsl:for-each is not getting a text value that is between conceptName tags? I would like to mention that I don't have to use data from xml since this stylesheet is getting it via external instructions using: bri:concept method. Comments are more than welcome!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...