• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSLT equality test

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...***
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
reply
    Bookmark Topic Watch Topic
  • New Topic