• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSLT equality test

 
Daniel Walker
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...
I am currently designing a stylesheet which formats an XML dbase of academic publications and displays it in typical bibliographic style (eg. the Harvard system). There are about 15 different types of publication, and each different type must be displyed slightly differently. The stylesheet currently looks like this:

Basically, the "Type" element of each entry in the dbase contains the entry's type, and depending on what this value is I would like to invoke the correct xsl:template (one for each entry type).
However, the code above does not work - the default rule is invoked each time. Does anybody have any idea where I am going wrong? In addition, any sugestions on better ways of doing this would be appreciated too.
I thank you all in advance.
------------------
daniel.walker
***i fear that i am ordinary...
...just like everyone...***
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Walker:
However, the code above does not work - the default rule is invoked each time.


It worked for me with Xalan and even IE 5.0. on test file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="bool.xsl"?>
<PUBLICATIONS>
<CCI_RECORD>
<Type>Article</Type>
</CCI_RECORD>
<CCI_RECORD>
<Type>inBook</Type>
</CCI_RECORD>
<CCI_RECORD>
<Type>inProceedings</Type>
</CCI_RECORD>
</PUBLICATIONS>
The output:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CCI Publications</title>
</head>
<body>
<P>This is an article...</P>
<P>This is an inBook...</P>
<P>This is an inProceedings...</P>
</body>
</html>
Which processor do you use anyway?
 
Daniel Walker
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mapraputa - it seems that my XML file was the problem. I am currently using IE6 (the final product will use a server side transform however, probably with Xalan)
Take a look :

Evidently, it was a problem with whitespace or CR or something. I have now arranged the XML file in the same format as your example, and it works great.
My XSL and XML files now looks like this:

Each entry type will have a section like the "Article" match, except with different formatting etc.
However, I would like to be able to substitute the final comma in each entry with a full stop (period) - do you know of a good way of doing this?
Thanks again.
[This message has been edited by Daniel Walker (edited September 20, 2001).]
[This message has been edited by Daniel Walker (edited September 21, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic