xsl-list
[Top] [All Lists]

Re: [xsl] Execute Stylesheet

2008-03-07 13:13:09
Many thanks to all.  It is working now as I desired.


I have one thing I would like to understand further
In Colin's response, there is the following

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

Colin> That is definitely not best - it is inefficient, and is unnatural.

Why inefficient and unnatural?

Thanks
Sean
====

On Fri, Mar 7, 2008 at 2:46 PM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:
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?

 You can do either.

 I would change the argument to unparsed-text() to
 "file:///c:/comma_delimited.txt". The spec requires a URI here, not a
 Windows filename. Some environments might let you get away with the
 filename, but it all depends on your configuration.

 I would also, as Colin suggests, add name="entry" to your initial template
 so you don't have to supply a dummy source file. But keep the match="/" as
 well for the time being if you ever want to run it with Altova, which
 doesn't yet support entry at a named template.

 Michael Kay
 http://www.saxonica.com/


 >
 > 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
 >


--~------------------------------------------------------------------
 > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
 > or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
 > --~--
 >


 --~------------------------------------------------------------------
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
 or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
 --~--





-- 
Sean Tiley
sean(_dot_)tiley(_at_)gmail(_dot_)com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>