While RegEx is a powerful tool and an absolutely wonderful addition to
XSLT in version 2.0 it's not something thats really going to make the
difference in making sample below possible... You can do it now in 1.0
using a combination of string functions, the contain function and either
an XML file that contains all possible ways the author may be referenced
or a combination of variables to act in the same capacity (the former
requiring much less code and being more inline with how XSLT was
designed to be used in the first place... a way to match element(s)
and/or attribute(s) patterns based on given criteria and output a given
set of data (static or dynamic) when the pattern is found.)
Something similar to the following would work using 1.0 (this example
uses "citation" as the current context node):
<xsl:variable name="author-variations"
select="document('author.xml')/author/name"
<xsl:if test="contains(preceding-sibling::text()[1],
$author-variations/text-variations)">
output this...
</xsl:if>
The author.xml file is obviously just a foo example and as such the
element structure and name usage is just a foobar represenation of what
it might look like... but the concept is there and after being properly
modified to fit your needs will give you what you want... Of course
RegEx will make the process of finding a pattern with unlimited
variations within a text node mere childs play... but to accomplish what
you are attempting is definitely not the only way to do it.
Hope this helps!
<M:D/>
Bruce D'Arcus wrote:
I'm not really that familiar with regular expressions (beyond the
basics), nor with the specifics of their implementation in XSLT 2.0.
How easy is it to have regexp code that can take this:
<para>Acccording to Doe <citation><biblioref
linkend="doe99"/></citation> ...</para>
.... and to see that while standard processing code would yield this:
<p>According to Doe (Doe, 1999) ...</p>
.... the author name is preceding the citation, such that the output
should be:
<p>According to Doe (1999) ...</p>
?
Put differently, would there be a good way to look at the text
immediately preceding a citation (probably in the entire sentence
preceding it) to see if the author is noted there?
I should add that historically (in bibtex for example), the author
would manually code the citation to indicate how it should be
rendered. I'm just wondering if that's really necessary, and perhaps
simply awkward (for example, in a GUI app, it means requiring some
sort of interface for the author to indicate how it ought to be
rendered, while using the approach I'm suggesting above would be much
simpler).
Bruce
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--