xsl-list
[Top] [All Lists]

RE: [xsl] Output to a file...

2007-07-23 11:57:55
Question - is it possible to create a .txt file via XSLT?


-----Original Message-----
From: Naschke, Pete 
Sent: Monday, July 23, 2007 1:27 PM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] Output to a file...and line feeds...

I verified that my XSLT file does have the <xsl:output method="text" />
line...but when does the program ask for a filename to save the data
file to??

Here's my XSLT file...

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="text" />
  <xsl:template match="/">
    <xsl:apply-templates
select="windowgroup/windowgroupings/windowgrouping" />
  </xsl:template>
  <xsl:template match="windowgrouping">
    <xsl:value-of select="shortdescription/@Value" />
    <xsl:text></xsl:text>
    <xsl:value-of select="longdescription/@Value"></xsl:value-of>
    <xsl:text></xsl:text>
    <xsl:value-of select="longdescription/@Value"></xsl:value-of>
    <xsl:text></xsl:text>
  </xsl:template>
</xsl:stylesheet>

How do I use, where do I find XSLT 2.0? I am using the Microsoft program
XML Notepad...does it somehow allow the user to select XSLT 1.0 or XSLT
2.0??

I think if I get this file output problem figured out, I'll be able to
do more effective program development.


-----Original Message-----
From: Andrew Welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com] 
Sent: Monday, July 23, 2007 11:31 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Output to a file...and line feeds...

On 7/23/07, Naschke, Pete <NaschkePS(_at_)pella(_dot_)com> wrote:
1. How is the best way to create a new text file (or Excel CSV file)
using an XSLT file?

If you mean in addition to the result of the transform then it's like
DC says, but if you mean _as_ the result of the transform then use
<xsl:output method="text"/>

2. how is the best way to create a line-feed? (After printing my comma
separated values, I need to "drop down" a line for the next data
group.)

If you are creating it using a function (such as concat()) within an
attribute then I use &#xa; (which is &#10; :) otherwise use
<xsl:text>&#xa;</xsl:text> I would advise against doing:
<xsl:text>
</xsl:text>
..because it becomes a maintenance issue when you can see how much
white space you're adding to the result.


-- 
http://andrewjwelch.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>
--~--


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