XSLT 1.0 is primarily there for processing the trees created by parsing
your already-marked-up XML documents. It's not nearly as useful when the
task you want to perform is to create markup by recognizing patterns in
the text. You can do this, but it's really hard work.
XSLT 2.0 is much better at these so-called "up-conversion" applications
because it supports regular expression matching on the text. So you need
to make a decision:
(a) are you going to try to automate the markup process?
(b) if so, what technology are you going to use: XSLT 1.0, XSLT 2.0, or
something else?
Michael Kay
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Renzo
Sent: 31 December 2003 02:16
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] newbie question on formatting
hi -
this is a newbie question for which i could not find an answer in the
faqs. sorry if it is covered there and i didn't see it.
i am trying to come up with a simple xml that i can process
against an
xsl to get html (for now, eventually, i will want PDF output
as well).
for the most part, this is working fine with
java org.apache.xalan.xslt.Process -HTML -DIAG -IN foo.xml
-XSL bar.xsl
-OUT foobar.html
now, one problem that i don't know a straightforward solution for is
this: say i have an xml element
<element>my name is foobar</element>
that i want to turn into an html snippet
<p>my name is <a href="mailto:foobar(_at_)foobar(_dot_)com">foobar</a></p>
what's the best solution?
- i obviously don't want <a> tags and such in the xml; even if i did,
org.apache.xalan.xslt.Process strips them out, as one might expect
- ideally, i also don't want to tag 'foobar' in the xml in
any other way
(say <link attr="foobar">foobar</link>), since a) i'd like to
have the
xml as clean as possible, so that it becomes easily editable
for someone
even more of a newbie than myself and b) if i wanted to use
the xml for
a non-html output, then <link> no longer makes much sense
- one possibility i was considering is having a list of foobar-like
items as entities and then globally replace these with what's
appropriate, something simple like
<item>
<name>foobar</name>
<link>mailto:foobar(_at_)foobar(_dot_)com</link>
<style>bold</style>
</item>
so that for html output, it gets turned into an mailto href
(although i
am not sure about the specifics of that), and for pdf output,
into bold text
this somehow doesn't feel right, so i am wondering whether there is a
better and straightforward way.
the same question of course relates to any other kind of
formatting that
applies to items that are not themselves containers (such as table
cells, etc)
thanks
renzo
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list