• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

easy way to view transformations

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want a quick way to view the results of of xsl transformation on an xml document. I thought that in my xml document I could put something like:
<?xml version="1.0" standalone="yes"?>
<?xsl-stylesheet type="text/xsl" href="match.xsl"?>
then I would have my .xsl file called match.xsl which would do some sort of transformation. Shouldn't I just be able to open up the .xml file in IE and it would use the .xsl file to do the transformation, similar to using CSS?
Thanks
Brian
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a word of caution - IE is not 100% compliant with XSLT spec. I suggest using a command line XSLT engine like Xalan to generate the output file. Infact if you use the Transform namespace with IE you may not even get any output - AFAIK, IE accepts and works fine with the WD-xsl namespace only.

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ajith Kallambella:
Just a word of caution - IE is not 100% compliant with XSLT spec. I suggest using a command line XSLT engine like Xalan to generate the output file. Infact if you use the Transform namespace with IE you may not even get any output - AFAIK, IE accepts and works fine with the WD-xsl namespace only.


Can u explain...what is command line XSLT engine like Xalan.what it will do, is it browser like.
And wot is the difference b/w Transform namespace and WD-xsl namespace and how they differ.
Which versions of Netscape can support XML files and does it have XSL transformation.

 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anil,
There are a number of free XML parsers you d/l and run from the command line: Xalan, XT, XML4J, Saxon etc
With XT you can type: xt file.xml file.xsl > file.html
XT (and the other parsers) will translate the .xml file using the .xsl stylesheet and output an .html file which you can then load in your browser.
IE5 will has a sort of 'built-in' parser; if seen some examples at http://www.xmlpitstop.com/default.asp?DataType=XMLEXAMPLES Tried
a few of my own files w/o much luck; imagine it has to do with Ajith's response (not sure what the diff is between WD-xsl and Transform .. Ajith?)
Netscape 6 recognizes XML (earlier versions don't); looked at it today but it also would not recognize the XSL ... not sure why yet.
Easiest method is just to use one of the parsers
Hope that helps.

------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
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
As to difference between Transform namespace and WD-xsl, Khun Yee Fung explained it here: http://www.javaranch.com/ubb/Forum31/HTML/000425.html
Observation: �WD-xsl" doesn�t work for Xalan, �...Transform'� does.
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah i got it..thx for ur responses..which is considered as best command line XSLT engine..?
anil
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anil,
I don't know if it's the <i>best</i> but XT is certainly easy to use; you can d/l it from http://www.jclark.com/xml/xt.html
Map ... thanks
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AFAIK XT was the first XSLT engine that was ever written and James Clark is too good. I like XT too!
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the first XSLT processor we used was LotusXSL, now called Xalan. I used Saxon for command line checking quite a bit as well. Then I started using XT. I have not stopped using it. We even used it for generating WML and HDML (no kidding!) for some cell phones, with the output engine modified a bit to support <xsl:output method='wml'/> and <xsl:output method='hdml'/>. (At least one cell phone do not support & as part of a URL in WML, so we have to hack it to make sure the character & is used.)
If you are interested in knowing where XT is going, go to http://www.4xt.org. James Clark does not support XT any more.

------------------
Khun Yee Fung
Author of XSLT: Working with XML and HTML
 
Khun Yee Fung
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, apparently UBB is too intelligent to change my &#38; to & in my post. So,
"At least one cell phone do not support & as part of a URL in WML, so we have to hack it to make sure the character & is used."
should have been:
"At least one cell phone do not support &#38; as part of a URL in WML, so we have to hack it to make sure the character & is used."

------------------
Khun Yee Fung
Author of XSLT: Working with XML and HTML
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brian!
You're right, it's something like that, but not exactly.
The right string is:
<?xsl:stylesheet type="text/xsl" href="match.xsl"?>
(A colon ':' instead of '-' in xsl:stylesheet)
This is a quick and handy way to view your transformation, but works only in MSIE 5
Regards,
Marius
 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marius. I tried that but got the following error (I'm using IE 5.5):
Entity, EntityRef, PI, Notation names, or NMToken cannot contain a colon. Line 2, Position 18
Any ideas?
Thanks
Brian
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic