I’m trying to define an XSLT stylesheet to use with my query results, and I keep getting the error that I have an invalid name for the element xsl:stylesheet.
I’m using Tamino 3.1.1.1.
W/ this schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=“XML Schema”>
<xs:element name=“xsl:stylesheet”/>
</xs:schema>
How do I define this, if it doesn’t allow namespaces?
Tamino does not properly support namespaces at the moment but you can define a schema to accept instances of xsl:stylesheet. Below is a schema I’ve used:
<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:xs = “XML Schema”
xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition”
targetNamespace = “XSLT Namespace”
attributeFormDefault = “qualified”
xmlns:xsl = “XSLT Namespace”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “stylesheet”>
<tsd:collection name = “stylesheet”></tsd:collection>
<tsd:doctype name = “xsl:stylesheet”>
tsd:logical
tsd:contentopen</tsd:content>
</tsd:logical>
</tsd:doctype>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = “stylesheet”>
xs:complexType</xs:complexType>
</xs:element>
</xs:schema>
Hope that helps.
You have to include the definition of the xsl namespace. I’m a bit of a beginner on XML Schemas myself, and I haven’t checked whether this works on Tamino, but I think you want:
<xs:schema xmlns:xs=“…”
targetNamespace=“XSLT Namespace”>
<xs:element name=“stylesheet”/>
Michael Kay
Thanks - that worked (after I added a target namespace prefix).
I was able to import a stylesheet and I can do a search on it, but I can’t seem to find it when I do this:
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql/whitman/CollectionStyle.xsl=//div1
it tells me that:
The system cannot locate the object specified. Error processing resource ‘http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman/CollectionStyle.xsl’.
I know I imported it under the cindy database and whitman collection - shouldn’t it be there?
The query syntax is the problem here, and I’m not really sure what it is you are trying to achieve.
This is your query that does not work:-
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql/whitman/CollectionStyle.xsl=//div1
Assuming the following is true:
- database is cindy
- collection name is whitman
- document type is xsl:stylesheet
- and you’ve stored a document into the above with a docname of CollectionStyle.xsl
you can do one of the following:
1) get the entire document :
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman/xsl:stylesheet/CollectionStyle.xsl
2) get elements of the document :
<A HREF=“http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql=xsl:stylesheet[@ino:docname=“CollectionStyle.xsl”]//div1” TARGET=_blank>http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql=xsl:stylesheet[@ino:docname=“CollectionStyle.xsl”]//div1
This query works:
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql=//div1
And I just want to process the results through the XSLT stylesheet for display.
I couldn’t get either 1) or 2) of the above suggestion to work, which makes me wonder if the CollectionStyle.xsl file is where I think it is.
I know that the database, collection, doctype, and filename are correct - but I don’t know where Tamino is putting the file itself.
Other than using XPlorer, is there a way to find what files are in a specific collection?
Ok I understand now what it is you are trying to do. It seems that you have your documents stored in the “whitman” collection. It also seems that you are storing stylesheets into the same collection and there seems to be problem there. Maybe the problem is in how you are storing the stylesheet.
If you want to store an XML document or nonXML document into a particular collection with a specific document name (in your case CollectionStyle.xsl) you can do the following:
(1) startup Tamino Interactive Interface;
(2) set the Database URL the the collection type, document type and actual document name, for instance:
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman/xsl:stylesheet/CollectionStyle.xsl
(3) leave collection name blank
(4) use the browse button to find the source xsl file
(5) click “Process”.
If you don’t specify the database URL in the manner above and instead just specify database URL and also specify the collection name in the Collection field of the TII and perform the process command, the document gets stored without a filename.
If you want to find out if documents do/do not have a document name assigned you can issue a query, e.g:
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql=xsl:stylesheet/
which returns the root tag only of the document. If the document has a document name assigned you will see something like:
<xsl:stylesheet ino:id=“1” ino:docname=“CollectionStyle.xsl”
in the result. Otherwise if the document does not have a document name assigned the ino:docname attribute is missing.
hope this helps.
Great! That helped.
So now, when I try this:
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql/xsl:stylesheets/CollectionStyle.xsl=//div1
I get this error:
Access is denied. Error processing resource ‘xsl:stylesheets/CollectionStyle.xsl’.
So, I’m assuming that means it sees the stylesheet now, but the servlet doesn’t work.
Am I correct?
I think things need to be clarified. There’s two ways you can style an XML document with Tamino:-
1) Use the pass-thru-servlet. This is a java servlet which runs under JServ or Tomcat. Basically with that the URL contains the URL of the styler servlet, plus the Tamino URL and a parameter _xslsrc which is the reference to the stylesheet. The servlet performs the query and then styles it with stylesheet. The response object is the styled XML document which will probably be HTML.
2) Asking Tamino to include an xsl:stylesheet processing instruction. This is done by appending the URL of the stylesheet after the _xql but before the = sign of the query. It looks from this thread that this is what you are trying to do but I’ve also seen your thread regarding Tomcat and that is the above method. With this method the browser performs the styling and if your browser does not understand XML or styling they won’t get the results you want them to have.
So how to specify the correct URL, and what is wrong with your URL.
Lets assume the following:
o Base URL = http://jefferson.village.virginia.edu:8070/
o database URL = cindy
o collection = whitman
o query is //div1
o stylesheet doctype = xsl:stylesheet
o and you’ve loaded the stylesheet in and called it CollectionStyle.xsl
1) If you want the most flexability I would suggest using the pass-thru-servlet. It styles the XML response from Tamino within a servlet so it does not matter what browser your clients are running.
So lets assume you’re running Apache say on port 8070 and you’ve configured mod_jk so all references to /styler/* go to Tomcat. Also I will assume you’ve configured Tomcat with a directory called styler with the appropiate WEB-INF/web.xml and WEB-INF/lib; and that in web.xml you’ve configured an alias called ‘styler’ to point to the TaminoFilter class. The URL will be :
http://jefferson.village.virginia.edu:8070/styler/servlet/styler/tamino/cindy/whitman?_xql=//div1&_xslsrc=http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman/xsl:stylesheet/CollectionStyle.xsl
2) If you want the browser to do the work the URL will be:
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql//tamino/cindy/whitman/xsl:stylesheet/CollectionStyle.xsl=//div1
[This message was edited by Stuart Fyffe-Collins on 09 Jul 2002 at 16:15.]
For now, I just want to get it working from the browser - the next step will be to get the passthru working w/ Tomcat.
So, the query below sees and processes the stylesheet, but I’m not getting a result from the query. What else am I doing wrong?
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql//tamino/cindy/whitman/xsl:stylesheet/CollectionStyle.xsl=//div1
A few questions then:
1) whats the error you get from Internet Explorer ?
2) Does the following URL bring back required documents ?
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman?_xql=//div1
3) Does the following URL bring back a valid stylesheet ?
http://jefferson.village.virginia.edu:8070/tamino/cindy/whitman/xsl:stylesheet/CollectionStyle.xsl