Filemaker XSL - if node contains specific text - just will not work



I have an XML file like this:



<propertys>
<property>
<ref>12345</ref>
<description>Lovely house with swimming pool.</description>
</property>
<property>
<ref>54321</ref>
<description>Lovely house with outbuildings and lake.</description>
</property>
<property>
<ref>67890</ref>
<description>Lovely house with garage and further parking.</description>
</property>
</propertys>


I have a number of output fields such as Lake, Garage, Swimming Pool, Parking and others.


When I import this XML into Filemaker using XSL, I want to check if the description node contains the word 'pool' and then set the corresponding output field as Yes.



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR" exclude-result-prefixes="xsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<FMPXMLRESULT xmlns="http://ift.tt/1ckTOKc">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="FileMaker" VERSION="ProAdvanced 12.0v4"/>
<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>
<METADATA>
<FIELD EMPTYOK="NO" MAXREPEAT="1" NAME="Ref" TYPE="TEXT" />
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="SwimmingPool" TYPE="TEXT" />
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Garage" TYPE="TEXT" />
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Parking" TYPE="TEXT" />
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Lake" TYPE="TEXT" />
</METADATA>

<RESULTSET FOUND="">
<xsl:for-each select="propertys/property">
<ROW RECORDID="" MODID="">

<!-- REF -->
<COL><DATA><xsl:value-of select="ref"/></DATA></COL>

<COL><DATA>
<xsl:if test="contains(description,'pool')">
Yes
</xsl:if>
</DATA></COL>

<COL><DATA>
<xsl:if test="contains(description,'garage')">
Yes
</xsl:if>
</DATA></COL>

<COL><DATA>
<xsl:if test="contains(description,'parking')">
Yes
</xsl:if>
</DATA></COL>

<COL><DATA>
<xsl:if test="contains(description,'lake')">
Yes
</xsl:if>
</DATA></COL>

</ROW>
</xsl:for-each>
</RESULTSET>
</FMPXMLRESULT>


I have tried every which way, including applying templates, and I cannot get this to work yet it all seems fine from having spent hours Googling and Googling.


When the data comes into Filemaker, the Swimming Pool and other fields are blank.


Help much appreciated!


No comments:

Post a Comment