|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Preserving White Space in Immediate following-sibling
I'm having a problem preserving white-space between two elements that
immediately follow each other. For example, I can have the following two
paragraphs in XML:
<p>Sentence 1.<xref ref-type="bibr" rid="b1">1</xref> Sentence 2. <xref
ref-type="bibr" rid="b2">2</xref> Sentence 3.</p>
<p>Sentence 1.<xref ref-type="bibr" rid="b1">1</xref> <xref
ref-type="fig" rid="F1">Figure 1</xref> continuation of Sentence 2 which
started with a reference.</p>
The first one will be translated correctly, but the second one ignores
the white space between the two xref tags so that the output is:
"Sentence 1.1Figure 1 continuation of Sentence 2 which started with a
reference."
I tried remedying my problem with the following XSLT:
<xsl:template match="xref">
<xsl:if test="@ref-type = 'bibr'">
<sup><a href="#{@rid}"><xsl:value-of select="."/></a></sup>
</xsl:if>
<xsl:if test="@ref-type = 'fig'">
<a href="#{@rid}"><xsl:value-of select="."/></a>
</xsl:if>
<xsl:if test="following-sibling::*[1][self::xref]"> </xsl:if>
</xsl:template>
Which fixed my second paragraph, but altered my first paragraph by
adding an extra space after the first xref. I'm not exactly sure why the
white space in the second paragraph is being ignored initially. Is there
a way to write my code to see if there is any text in-between the xref
tags and if not add the space?
Joe Heidenreich
Programmer
heidenreichj@xxxxxxxx
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








