views:

1060

answers:

5

Alright this seems like a stupid question but I can't figure it out. I'm writing an XSLT file to translate an XML document into an XHTML document. I've used both Visual Studio and XML Notepad 2007 to preview the results of my XSLT file, but now I want to actually write out a real XHTML file so I can see how it looks in other browsers.

Neither Visual Studio or XML NotePad have an obvious way to save the preview. Am I missing something. Obviously the file is getting created because something is being previewed, but I need to know where that file is being created or better yet choose its location.

+2  A: 

If you don't mind going to the command line and XSLT 1.0 is what you want: msxsl.exe

Tomalak
For windows, I would rather recommend NXSLT 3.0 for 1.0, and of course Saxon for 2.0.
Pavel Minaev
What's the reason that NXSLT is better? (Just interested.)
Tomalak
+1 for being the solution I ended up using at the time, but Roberts solution would have been better.
Eric Anastas
+4  A: 
BryanH
+1  A: 

Back in the day, I used Internet Explorer Tools for Validating XML and Viewing XSLT Output. It gives you a right click option in IE to "View XSL Output". It only shows support back to Windows XP, but I bet it still works.

Ishmael
A: 

A client side batch XSLT transform tool, CoherentWeb might suit your needs, more screenshots are here and YouTube video here.

It, like Visual Studio, has a built in browser. But CoherentWeb also persists the output files in a more accessible way for testing with other browsers. It can also automatically copy all resource files within a folder structure that you need to maintain any relative file references within your XML/XHTML.

While this tool is designed to cope with up to 10,000 input files in a folder structure, its fine with just the one file. Its also fully integrated with a specially enhanced version of SketchPath, for XPath testing.

Finally, once you have your XHTML then ExpressionWeb SuperPreview is an excellent tool for viewing/comparing XHTML rendering in multiple browsers.

CoherentWeb XSLT batch processor: screenshot

pgfearo
+3  A: 

In Visual Studio, add the XML file to a project. Open the XML file. When the file is open and its window is active, you should see, in the Properties window, that you can specify an output filename and a stylesheet. Also, you should see that the menu bar now contains an "XML" item.

If you pick "Show XSLT output" from the "XML" menu, VS will apply the specified transform to the XML file, write its output to the file you specified, and then open that file. If the file has an .xml extension, it'll open it in a text editor window; if it has an .htm extension, it'll open it in a browser window.

It's a little bit clunky (it seems to me that a menu that appears and vanishes instead of being enabled/disabled is kind of hinky), but it works well enough, and it's in the tool you're already using.

Robert Rossney