Subject: Re: [xsl] Referencing content in XML and then processing in XSLT 2.0 From: James Fuller <james.fuller.2007@xxxxxxxxx> Date: Tue, 23 Mar 2010 20:48:12 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Referencing content in XM, Michael Ludwig | Thread | Re: [xsl] Referencing content in XM, Jacobus Reyneke |
Re: [xsl] Referencing content in XM, Michael Ludwig | Date | [xsl] Grouping and sorting using cu, Larry Hayashi |
Month |