[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] multiple xreferences: [1,2,3] and [4]
Hi, If you want to test if an xref is immediately preceded by another xref, then this test should work: test="preceding-sibling::node()[1][self::xref]" The node() selector lumps together text nodes, comments, elements, and processing instructions, so the first step selects preceding sibling nodes of all types. The [1] selects the closest one, and the [self::xref] tests to see if the selected node is an xref element. The xref has to be immediately preceding, with no white space, not even a line feed between them. Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net ----- Original Message ----- From: "Juha Mustonen" <juha.mustonen@iki.fi> To: "Docbook Apps" <docbook-apps@lists.oasis-open.org> Sent: Wednesday, October 11, 2006 11:33 PM Subject: [docbook-apps] multiple xreferences: [1,2,3] and [4] > > Here's the thing. I need to show the biblio references like this: > > "one reference [1] and the some more [2, 3, 4] and so on..." > > I've successfully edited the <xsl:template match="xref" name="xref"> and > it > does work with one exception: If there are two on more single references > in > one paragraph, right square bracket is missing (=> foo bar [1 lorem ipsum > 2]). > > Problem is that I haven't found a way to test whether xreferences are > right > next to each other or if there is some text between. > > Here's what I've managed to do so far: > > <!-- show multiple references like: [1, 2, 3] --> > <xsl:otherwise> > <xsl:if test="not(parent::citation)"> > <!-- set "[" only if first xref entry --> > <xsl:choose> > <xsl:when test="not(preceding-sibling::xref)"> > <xsl:apply-templates select="$target" > mode="xref-to-prefix"/> > </xsl:when> > <!-- otherwise put space --> > <xsl:otherwise> > <xsl:text> </xsl:text> > </xsl:otherwise> > </xsl:choose> > </xsl:if> > > .... > > <xsl:if test="not(parent::citation)"> > <!-- set "]" only if last xref entry --> > <xsl:choose> > <xsl:when test="not(following-sibling::xref)"> > <xsl:apply-templates select="$target" > mode="xref-to-suffix"/> > </xsl:when> > <!-- otherwise put comma --> > <xsl:otherwise> > <xsl:text>, </xsl:text> > </xsl:otherwise> > </xsl:choose> > </xsl:if> > </xsl:otherwise> > > Regards, > Juha > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]