473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

xsl problem with test expression

I've written a small xsl file,

but it is not working, it doesn't do the xsl:when test,

what is wrong with it?

The xsl-file:

********

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet
version="1.0":xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template
match="Faculty/select"><html><body>

<xsl:for-each select="group">

<xsl:variable name="type">

<xsl:value-of select="team_type" />

</xsl:variable><xsl:choose>

<xsl:when test="$type='V'">

<xsl:value-of select="name_dutch"/>

<xsl:value-of select="team_code"/>)<br/>

</xsl:when> </xsl:choose></xsl:for-each>
</body></html></xsl:template></xsl:stylesheet>

the xml-file-extraction

*****************

<?xml version="1.0" encoding="ISO-8859-1"?>

<Faculty><select><group>

<team_code>DWIS</team_code>

<name_dutch>Wiskunde</name_dutch>

<team_type>V</team_type>

</group></select></Faculty>

Jul 20 '05 #1
2 1587
Hi,
version="1.0":xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template --------------/
there's a syntax error here, after correction I could not see any errors related to 'xsl:when'
match="Faculty/select"><html><body>
<xsl:for-each select="group">
<xsl:variable name="type">
<xsl:value-of select="team_type" />
</xsl:variable><xsl:choose>
<xsl:when test="$type='V'">
<xsl:value-of select="name_dutch"/>
<xsl:value-of select="team_code"/>)<br/>
</xsl:when> </xsl:choose></xsl:for-each>
</body></html></xsl:template></xsl:stylesheet>


btw, is it really necessary to use a variable and a 'xsl:choose'?

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="Faculty/select">
<html><body>
<xsl:apply-templates select="group"/>
</body></html>
</xsl:template>

<xsl:template match="group[team_type='V']">
<xsl:value-of select="name_dutch"/>
<xsl:value-of select="team_code"/>)<br/>
</xsl:template>

<xsl:template match="group"/>

</xsl:stylesheet>

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #2
> I've written a small xsl file,

but it is not working, it doesn't do the xsl:when test,
the xml-file-extraction

*****************

<?xml version="1.0" encoding="ISO-8859-1"?>

<Faculty><select><group>

<team_code>DWIS</team_code>

<name_dutch>Wiskunde</name_dutch>

<team_type>V</team_type>

</group></select></Faculty>

If the above is only a sample, it is most likely that whitespaces are spoiling the fun in the real XML.
Try using <xsl:when test="normalize-space($type)='V'"/>

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Shawn Milo | last post by:
I put this together yesterday, and I thought I'd share it. It works in both IE and Mozilla Firefox. I posted something similar to this months back, but it was much longer, and only worked in IE....
27
by: C Gillespie | last post by:
Dear All, Hopefully I have a simple problem. Basically, I just want to alter some text with JS. Here is some of my test code: <snip> <script type="text/javascript"> var tmp='a';
6
by: Karel Miklav | last post by:
If I test() string two times in a row like: var re = new RegExp(expression, "gi"); re.test(s1); re.test(s1); only the first test passes. Is this normal? --
18
by: jslowery | last post by:
I am not completely knowledgable about the status of lexical scoping in Python, but it was my understanding that this was added in a long time ago around python2.1-python2.2 I am using python2.4...
3
by: bumwipe | last post by:
I am trying to create a program that takes string expressions and solves them mathematically (i.e. string "5 + 4 * 2" will evaluate as 13). i have this much of the program made, but I am not sure...
4
by: carlos | last post by:
I am working on a regular expression validation for my search page. What I have so far works for most cases, but I would like to fine tune it some. I am new to regular expressions, and I do not...
8
by: aarklon | last post by:
Hi all, see:- http://linuxgazette.net/issue51/pramode.html
4
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global'...
2
by: cioccolatina | last post by:
Hey guys, is there anyone who could help me..? I have file ExpressionBinaryTree.java : /** class ExpressionBinaryTree * uses a binary tree to represent binary expressions * does not...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.