xsl-list
[Top] [All Lists]

RE: Read a txt file

2004-12-15 05:45:39


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/


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