xsl-list
[Top] [All Lists]

[xsl] Child locations

2007-04-25 13:32:55
XSL Experts --

I'm trying to prevent the first occurrence of a child tag from line
breaking.

So for example I have the following xml:

<law>
        <section>
                <amended>
                        <catchline>This is the title</catchline>
                        <para>This is paragraph 1</para>
                        <para>This is paragraph 2</para>
                        <para>This is paragraph 3</para>
                </amended>
        </section>
</law>

I would want the output after running the xsl to look similar to this:

This is the title.  This is paragraph 1
This is paragraph 2
This is paragraph 3

Currently what I've tried in my xsl is this:
 <xsl:template match="amended/para">
                <xsl:for-each select = "child::node()">
                        <xsl:choose>
                                
<xsl:when test="child::node()[not(.=normalize-space(.))][1][self::para]
        <fo:inline>
                <xsl:value-of select = "." />
        </fo:inline>
</xsl:when>
<xsl:otherwise>
        <fo:block>
                <xsl:value-of select = "."/>
        </fo:block>
</xsl:otherwise>
</xslchoose>
</xsl:for-each>
</xsl:template>

I think the "<xsl:when test =
                                
"child::node()[not(.=normalize-space(.))][1][self::para]"
is what is wrong.  I've tried looking up all the pieces of this segment
of code, but have no real understanding what it is doing.  It is
something I pulled from a mail list archive.

Thanks for any and all help!


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>