Re: xsl/xslt pipeline: missing core concept?

Discussion in 'XML' started by Andy Fish, Jul 30, 2003.

  1. Andy Fish

    Andy Fish Guest

    XSLT converts a source XML tree to a result XML tree and then outputs it.
    Pretty much all of XSL is about specifying the first stage (i.e. the
    conversion); the output format is controlled by the <xsl:eek:utput> directive.

    If you want to output XML that is of a different character encoding, this
    should be as simple as specifying the encoding in the <xsl:eek:utput>

    However, it what you want is something out that's not XML you probably have
    3 choices:

    1. use <xsl:eek:utput method="text">. This will ignore everything in the output
    tree except text nodes and just dump them all out. In this case, if you want
    to escape a certain character in a certain way you just have to do search
    and replace inside XSL which is a bit long winded.

    2. look for an XSLT processor which can output in the specific format you
    want (e.g. tex). I don't know what output formats are supported by the
    various processors.

    3. post-process the output XML yourself, or don't use XSLT at all.

    One other point. If whitespace characters are significant in your output
    format, you will need to be careful about controlling whitespace in the XML
    you generate.


    "James A. Robinson" <> wrote in message
    > Hello folks,
    > I'm hoping someone can point out a core concept I seem to be missing
    > w/re to the conversion of an XML document with XSL/XSLT. What do you do
    > when you need to take your unicode rich document and transform it to a
    > format which which needs something other numeric character references?
    > For example, what would I do if I wanted to output an XML document to a
    > format where I needed to replace the greek delta character with a very
    > specific string (say to something in TeX, or just 'delta' if outputting
    > to a plain text us-ascii encoded file)? I think I understand how core
    > xml parsing (input) handles unicode (be it native encoding or NCR), but
    > I don't understand what's supposed to happen when transforming the XML
    > to an output which does NOT support unicode or SGML style character
    > entities.
    > I am aware of the possibility of using an XSLT function which does a
    > substring search and replace for characters, but surely there is a
    > better option? I'm also aware I can do a final stage processing with a
    > tool of my own design (something which walks through and replaces
    > unicode characters with something else from a mapping). But is there a
    > core XSLT or other XML technology which I am missing that is intended
    > to solve this type of problem? Which lets me say that, if I'm
    > outputting a US-ASCII encoded document that instead of Δ I want
    > to dump out 'Delta' or '$\Delta$' or '<IMG SRC="/images/Delta.gif">'?
    > Thanks much for any wise words on the topic.
    > Jim Robinson
    Andy Fish, Jul 30, 2003
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
  2. Mike Brown
    Mike Brown
    Aug 3, 2003
  3. Vijay singh
    Martin Honnen
    Nov 4, 2004
  4. Replies:
    A. Bolmarcich
    May 27, 2005
  5. Gyoung-Yoon Noh
    James Britt
    Dec 24, 2005