xsl-list
[Top] [All Lists]

Re: [xsl] Referencing content in XML and then processing in XSLT 2.0

2010-03-23 14:48:37
simple token transclusion (or substitution) has always been an
interesting use case in xml technologies, for example you could use

* use entities ala dtd (dont do this! )

* xinclude and let the underlying parser deal with it (but you would
have xinclude statements in your xml)

* if you do define some sort of token for substitution ... but be
mindful if you are substituting mixed content, also I would approach
it differently depending if you are using XSLT 1 or XSLT 2  ... as for
format of the token you could go for something like simple (and
textual) like @sometoken@ or use an element ... I would probably start
off using <data:content id="">example data</data:content> or
<data:content xpath="">some example data</data:content>... putting it
into its own explicit namespace is probably safer but it may mean your
xslt has to manage namespaces a bit more, e.g. 'mileage may vary'

* you could learn from other templating approaches like TAL ... in
fact I remember someone doing a tal processor in xslt some time ago
here http://code.google.com/p/taltastic/ ... untested, never used, but
I have created a rough TAL processor in xquery

* another alternative might be to consider using XProc (xml calabash)
which has a p:replace and p:replace-string step, but these can be
emulated in xslt easy enough

lastly, if what you want is a standalone file with tokens for
replacement you will most likely need to have a multiple pass approach
if you intend to use xslt.

good luck, James Fuller

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--