I am having trouble with a template that has to check 3 different nodes
and if they are not empty, print the data
I am using for each node then doing the output but it is not printing anything. It is like the test returns zero.
I have selected the parent node of each node i want to check the length on as the template match but it still doesn't work.
Another thing, how do i sort the list using . I tried using this but i get an error about loading the stylesheet. If i take out the sort it works
<xsl:template match="folktask/member">
<xsl:if test="user/account/userlevel='3'">
<xsl:sort select="festival/event/datefrom"/>
<div class="userdiv">
<xsl:apply-templates select="user"/>
<xsl:apply-templates select="festival"/>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="festival">
<xsl:apply-templates select="contact"/>
</xsl:template>
This should hopefully finish all my stylesheets.
This is the template I am calling
<xsl:template match="contact">
<xsl:if test="string-length(contelephone)!=0">
<div class="small bold">TELEPHONE:</div>
<div class="large">
<xsl:value-of select="contelephone/." />
</div>
</xsl:if>
<xsl:if test="string-length(conmobile)!=0">
<div class="small bold">MOBILE:</div>
<div class="large">
<xsl:value-of select="conmobile/." />
</div>
</xsl:if>
<xsl:if test="string-length(fax)!=0">
<div class="small bold">FAX:</div>
<div class="large">
<xsl:value-of select="fax/." />
</div>
</xsl:if>
</xsl:template>
and a section of my xml. If you need me to edit my post so you can see the full code i will but the rest works fine.
<folktask>
<member>
<user id="4">
<personal>
<name>Connor Lawson</name>
<sex>Male</sex>
<address1>12 Ash Way</address1>
<address2></address2>
<city>Swindon</city>
<county>Wiltshire</county>
<postcode>SN3 6GS</postcode>
<telephone>01791928119</telephone>
<mobile>07338695664</mobile>
<email>
[email protected]</email>
</personal>
<account>
<username>iTuneStinker</username>
<password>3a1f5fda21a07bfff20c41272bae7192</password>
<userlevel>3</userlevel>
<signupdate>2010-03-26T09:23:50</signupdate>
</account>
</user>
<festival id="1">
<event>
<eventname>Oxford Folk Festival</eventname>
<url>http://www.oxfordfolkfestival.com/</url>
<datefrom>2010-04-07</datefrom>
<dateto>2010-04-09</dateto>
<location>Oxford</location>
<eventpostcode>OX1 9BE</eventpostcode>
<coords>
<lat>51.735640</lat>
<lng>-1.276136</lng>
</coords>
</event>
<contact>
<conname>Stuart Vincent</conname>
<conaddress1>P.O. Box 642</conaddress1>
<conaddress2></conaddress2>
<concity>Oxford</concity>
<concounty>Bedfordshire</concounty>
<conpostcode>OX1 3BY</conpostcode>
<contelephone>01865 79073</contelephone>
<conmobile></conmobile>
<fax></fax>
<conemail>
[email protected]</conemail>
</contact>
</festival>
</member>
</folktask>