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

Re: step code to XML???

Subject: Re: step code to XML???
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Aug 1999 15:29:14 -0400
xml code for white space
At 99/08/25 19:28 +0100, AposToliS Mikronis wrote:
I need to convert the following step code into an XML file.
I am not very familiar with XSL and XML and I don't know if it possible to
tranform something with no tags in it.


ENTITY buffer_gas_system SUBTYPE OF (plant_item) ABSTRACT SUPERTYPE OF (centrifugal_compressor); END_ENTITY;


ENTITY material_transfer_equipment SUBTYPE OF (process_equipment) ABSTRACT SUPERTYPE OF (fluid_transfer_machine); material_transfer_equipment_type : STRING; END_ENTITY;


If I can't do it using XSL is there any other way??

Yes you can't do it with XSL (XSL requires at least a well-formed XML input) and yes there is another way (among many).


Does anyone have any suggestions?

OmniMark is a very strong language and very robust.


It is also free, see: http://www.omnimark.com

An example is below.

I hope this helps.

........... Ken


T:\tolis>type test.txt ENTITY buffer_gas_system SUBTYPE OF (plant_item) ABSTRACT SUPERTYPE OF (centrifugal_compressor); END_ENTITY;


ENTITY material_transfer_equipment SUBTYPE OF (process_equipment) ABSTRACT SUPERTYPE OF (fluid_transfer_machine); material_transfer_equipment_type : STRING; END_ENTITY;

T:\tolis>type test.xom
CROSS-TRANSLATE

FIND-START
    OUTPUT '<?xml version="1.0"?>%n<test>%n'

FIND-END
    OUTPUT '</test>%n'

FIND WHITE-SPACE+
    ;eat superfluous white space

FIND "ENTITY" WHITE-SPACE+
     [ANY EXCEPT WHITE-SPACE]+ => ent WHITE-SPACE+
     ( "SUBTYPE OF" WHITE-SPACE+
       "(" [ANY EXCEPT WHITE-SPACE OR ")"]+ => sup ")" WHITE-SPACE* )?
     ( "ABSTRACT SUPERTYPE OF" WHITE-SPACE+
       "(" [ANY EXCEPT WHITE-SPACE OR ")"]+ => abs ")" WHITE-SPACE* )?
     ";" WHITE-SPACE*
     ( [ANY EXCEPT WHITE-SPACE]+ => str
            WHITE-SPACE+ ":" WHITE-SPACE+ "STRING" WHITE-SPACE* ";"
            WHITE-SPACE+ )?
     "END_ENTITY" WHITE-SPACE* ";"

    OUTPUT "<entity><name>%x(ent)</name>%n"
    OUTPUT "<subtype-of>%x(sup)</subtype-of>%n" WHEN sup IS SPECIFIED
    OUTPUT "<abs-sup-of>%x(abs)</abs-sup-of>%n" WHEN abs IS SPECIFIED
    OUTPUT '<object type="string">%x(str)</object>%n'
        WHEN str IS SPECIFIED
    OUTPUT "</entity>%n"

;end of file
T:\tolis>omnimark -s test.xom -of test.xml test.txt

T:\tolis>type test.xml
<?xml version="1.0"?>
<test>
<entity><name>buffer_gas_system</name>
<subtype-of>plant_item</subtype-of>
<abs-sup-of>centrifugal_compressor</abs-sup-of>
</entity>
<entity><name>material_transfer_equipment</name>
<subtype-of>process_equipment</subtype-of>
<abs-sup-of>fluid_transfer_machine</abs-sup-of>
<object type="string">material_transfer_equipment_type</object>
</entity>
</test>

T:\tolis>

--
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Website:  XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-01-2
Next instructor-led training:                     MT'99 1999-12-05/06


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.