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

RE: Read a txt file

Subject: RE: Read a txt file
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 15 Dec 2004 12:45:39 -0000
xsl read text file
> I need my xsl reads a txt file, like this:
> 
> 
> ------file.txt---------------
> 
> 10101010101010101111010101010
> 10101011100001010101010101010
> 00011010101010101010101011011
> 
> -----------------------------
> 
> I'd like to read this values and copy them in a xml
> element:
> 
> <vector>
> 10101010101010101111010101010
> 10101011100001010101010101010
> 00011010101010101010101011011
> </vector>

You can't do that directly in XSLT 1.0. 

In 2.0 it's simply:

<vector>
  <xsl:value-of select="unparsed-text('file.txt')"/>
</vector>

In 1.0 you can pass the contents of the file into the transformation as the
value of a string parameter, or you could use a URIResolver to wrap the text
contents into an XML document structure.
> 
> 
> 
> But I have other problem:
> This values are of a multidimensional vector (matrix).
> 
> 
> In XML, I can't have a element that has a vector
> structure, can I? What could  I do in this case?
> 

<matrix>
  <row>
    <cell>0</cell>
    <cell>1</cell>
  </row>
  <row>
     etc.

Michael Kay
http://www.saxonica.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.