aspose file tools*
The moose likes XML and Related Technologies and the fly likes XSLT equality test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT equality test" Watch "XSLT equality test" New topic
Author

XSLT equality test

Daniel Walker
Greenhorn

Joined: Aug 09, 2001
Posts: 19
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...***


<B>daniel.walker</B><BR><I>***bleed in your own light...<BR>...dream of your own life...***</I>
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
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?


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Daniel Walker
Greenhorn

Joined: Aug 09, 2001
Posts: 19
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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSLT equality test