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

RE: Output to a file...

Subject: RE: Output to a file...
From: "Naschke, Pete" <NaschkePS@xxxxxxxxx>
Date: Mon, 23 Jul 2007 13:55:51 -0500
RE:  Output to a file...
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 &#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

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.