Question on XSLT

R

RJN

Hi

Pardon me for posting an XML question here.
Can XSLT be applied for transforming .txt files or are they applicable
only for xml to xml transformation.

Currently all the clients send file to a server in one particular
format. The format of the file which the server accepts is going to
change. So we need to build an intermediate system which will do the
transformation from the old format to the new format. Can I use XSLT for
doing this? Is XSLT applicable only when xml to xml transformation is
involved?

Regards

rjn
 
A

_AnonCoward

:
: Hi
:
: Pardon me for posting an XML question here.
: Can XSLT be applied for transforming .txt files or are they applicable
: only for xml to xml transformation.
:
: Currently all the clients send file to a server in one particular
: format. The format of the file which the server accepts is going to
: change. So we need to build an intermediate system which will do the
: transformation from the old format to the new format. Can I use XSLT
for
: doing this? Is XSLT applicable only when xml to xml transformation is
: involved?
:
: Regards
:
: rjn
:


You can only use XSL to parse XML documents. You are much more flexible
with the output format.


One approach would be to manually parse your input files into an XML
document with a predetermined structure. Then, use XSL to parse that
intermediate form into whatever output format you need. When you need to
modify that final output format, you can modify the XSL transformation
document as needed.


HTH


Ralf
 
M

Marcie Jones

Hi RJN,
I don't know it's overkill for your particular situation, but you could also take a look at BizTalk, which can do text to xml transformations as well
as much more.

Marcie
 
J

Jay B. Harlow [MVP - Outlook]

RJN,
As _AnonCoward suggest, XSLT can only parse "XML", however in .NET it can
parse anything that can be "represented as" XML. In other words that has
either an XPathNavigator for or can be read with an XmlReader object.

For example the following article discusses ObjectXPathNavigator that allows
you to run XSLT against ANY object:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml03172003.asp

The following articles discuss how to create a custom XmlReader object:
http://msdn.microsoft.com/msdnmag/issues/01/09/xml/default.aspx
http://msdn.microsoft.com/msdnmag/issues/04/05/XMLFiles/

Depending on the format of the .txt file, I would probably create a custom
XmlReader object similar to the GedcomReader in the last link above.

Hope this helps
Jay


|
| Hi
|
| Pardon me for posting an XML question here.
| Can XSLT be applied for transforming .txt files or are they applicable
| only for xml to xml transformation.
|
| Currently all the clients send file to a server in one particular
| format. The format of the file which the server accepts is going to
| change. So we need to build an intermediate system which will do the
| transformation from the old format to the new format. Can I use XSLT for
| doing this? Is XSLT applicable only when xml to xml transformation is
| involved?
|
| Regards
|
| rjn
|
|
 
H

Herfried K. Wagner [MVP]

RJN said:
Can I use XSLT for
doing this? Is XSLT applicable only when xml to xml transformation is
involved?

The output doesn't necessarily need to be in XML format.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top