[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Execute Stylesheet

Subject: Re: Execute Stylesheet
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Fri, 7 Mar 2008 13:23:27 -0600
Re:  Execute Stylesheet
Hello,
I have a question, I am embarrassed to ask as it seems like it should be so easy


I have basically copied an xsl stylesheet from
http://www.xml.com/pub/a/2003/05/07/tr.html, with a slight
modification to the string that is being tokenized.  My plan is to
further modify and wrap the values in the file with elements.

I am using Oxygen as my XML editor of choice.

My question is how do I actually run this stylesheet?  I am used to
running a stylesheet against an xml file but I am at a loss as to how
to execute this one against the text file?  Can I run it from within
Oxygen or do I need to run it with a command line?

I am using XSLT 2.0 (Saxon)

My (copied) stylesheet is as follows

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:variable name="in" select="unparsed-text('c:\comma_delimited.txt')"/>
<xsl:template match="/">
<xsl:variable name="tokenizedSample" select="tokenize($in,',')"/>
<xsl:for-each select="$tokenizedSample">
<xsl:value-of select="."/>
<xsl:text>! </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Thanks
--
Sean

Hi, Sean,


No need to be embarrassed. It's one of those simple but non-obvious things that has probably tripped up lots of folks.

You could have the file work against any XML file, of course, but the usual solution to this problem is to have the XSL transform work against itself (since it is also XML).

So, with Saxon 9, the command line could look like this:

java -jar path-to-saxon\saxon9.jar -s:your_stylesheet.xsl -xsl:your_stylesheet.xsl -o:your_output.txt

Of course, you may be using the class rather than the jar, and you may need quotation marks if your path has a space in it (such as Microsoft's idiot decision to put a space in "Program Files").

I'm sure you get the gist of it, though: Use the stylesheet file as the source file of your transformation.

HTH

Jay Bryant
Bryant Communication Services
http://www.bryantcs.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.