[xsl] newbie question on formatting

Subject: [xsl] newbie question on formatting
From: Renzo <renzop@xxxxxxxxxx>
Date: Tue, 30 Dec 2003 21:15:56 -0500
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@xxxxxxxxxx";>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


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)


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

Current Thread