OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

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

[ Lists Home | Date Index | Thread Index ]
  • From: Amy Lewis <amyzing@talsever.com>
  • To: Ashvil <ashvil@i3connect.net>, xml-dev@xml.org
  • Date: Sat, 1 Jul 2000 14:25:09 -0400

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@mindspring.com          amyzing@talsever.com
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@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS