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

Re: Can XSLT be bi-directional ? XML + XSLT -> XHTML -> XML + (XSLT)

  • From: Amy Lewis <amyzing@t...>
  • To: Ashvil <ashvil@i...>, xml-dev@x...
  • Date: Sat, 1 Jul 2000 14:25:09 -0400

xslt xhtml
Is this question theoretical, or purely practical?

On Sat, Jul 01, 2000 at 09:49:26AM -0700, Ashvil wrote:
>Can XSLT be bi-directional ? Can you get the original XML information
>from the output file by using the original XSLT file.

Perfectly possible in theory, but not likely to happen, in practice, by
accident.

>An example would be a XML file is transformed using XSLT into XHTML. A
>User edits the data in the XHTML file (assuming no tags are harmed or
>replaced) and sends it back. Is it possible to convert the information
>in the XHTML file to it's original XML format using the original XSLT
>file only.

If the XSLT transform were written such that:

1. there was a strict, 1:1 mapping from original to output, with no
duplicates, and
2. there was a string, 1:1 mapping from output to original, with no
duplicates, and
3. the stylesheet contained templates for transforms in both
directions,

then yes.  Thinking of XSLT as a functional language (in the
mathematical sense), then the function applied (that is, the
stylesheet) would have to be designed to have these characteristics.  I
can't think of anyone who's written such an example.  It would be more
likely to find a situation where 1 and 2 above held, but 3 did not
(meaning that an additional stylesheet would be required to perform the
reverse transformation).

However, I rather suspect that the great majority of cases in practice
don't do unique mapping from one set of tags to another, but instead
lump some things together (tables come to mind immediately, but it's
easy to imagine a situation in which half a dozen different element
types in the original map to "h3" in the output).  So, practically
speaking, in many cases the transform may be unidirectional altogether,
with no real hope of programmatically recovering the original
information.

But it's always going to depend on the specific stylesheet.  If you
write it to be reversible (then fix the bugs ... ;-), then it should be
possible to reverse it, by applying {the same|another} stylesheet.

Amy!
-- 
Amelia A. Lewis          alicorn@m...          amyzing@t...
Never imagine yourself not to be otherwise than what it might appear to others
that what you were or might have been was not otherwise than what you had been
would have appeared to them to be otherwise.                    -- The Duchess

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.