Subject: RE: Output to a file...
From: "Naschke, Pete" <NaschkePS@xxxxxxxxx>
Date: Mon, 23 Jul 2007 13:55:51 -0500
|
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@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: 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.j.welch@xxxxxxxxx]
Sent: Monday, July 23, 2007 11:31 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Output to a file...and line feeds...
On 7/23/07, Naschke, Pete <NaschkePS@xxxxxxxxx> 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 
 (which is :) otherwise use
<xsl:text>
</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
|