xsl-list
[Top] [All Lists]

Re: following sibling not working

2003-06-29 15:28:58
On Sun, Jun 29, 2003 at 07:38:09PM +0100, David Carlisle wrote:

You have to give us _some_ clues:
what does your input document look like
what is the current node when that test is executed (eg what template is
it in)
when you say it doesn't work, do you mean you get an error, or just a
diifferent result.


My original document looks like this:

    <para role = "command-line-verbose">
        <emphasis role = "command">
            &script-name;
        </emphasis>
        <emphasis role = "mandatory-short-option">d</emphasis>
        <emphasis role = "mandatory-option">days</emphasis>
        <emphasis role = "mandatory-option-argument">days</emphasis>
        <emphasis role = "option">verbose</emphasis>
        <emphasis role = "option-with-argument">append</emphasis>
        <emphasis role = "option-argument">device</emphasis>
        <emphasis role = "option-with-argument">backup-to</emphasis>
        <emphasis role = "option-argument">device</emphasis>
        <emphasis role = "short-option">m</emphasis>
        <emphasis role = "option">multiple-archive</emphasis>
        <emphasis role = "option">verify</emphasis>
        <emphasis role = "option">quiet</emphasis>
        <emphasis role = "option">dummy</emphasis>
        <emphasis role = "option">no-remove</emphasis>
        <emphasis role = "mandatory-short-option">f</emphasis>
        <emphasis role = "mandatory-option">file</emphasis>
        <emphasis role = "mandatory-option-argument">file</emphasis>
        <emphasis role = "or">|</emphasis>
        <emphasis role = "arguments">path</emphasis>
    </para>


A fragment from my xsl document looks like this:

    <xsl:template match = "emphasis[(_at_)role = 'option']|emphasis[(_at_)role =
    'option-with-argument']">
        <xsl:if test = "not(preceding-sibling::*[1][(_at_)role = 
'short-option'])">
            <block new-lines-after = "1">
                <xsl:text>[</xsl:text>
            </block>
        </xsl:if>
        <block new-lines-after = "0">
            <xsl:text>.B --</xsl:text>
        </block>
        <block new-lines-after = "1">
            <xsl:apply-templates/>
        </block>
        <xsl:if test = "not(following-sibling::emphasis[1][(_at_)role = 
'option-argument'])">
            <block new-lines-after = "1">
                <xsl:text>]</xsl:text>
            </block>
        </xsl:if>
    </xsl:template>



I am not generating an error when I run my stylesheet. But the "if"
statement does not work. That is, the template with the "following
sibling" instruction outputs a bracket. My "if" statement is trying to
say "if the next sibling has the role with a value of 'argument', don't
output the bracket." 

I hope this is clearer

Thanks

Paul


-- 

************************
*Paul Tremblay         *
*phthenry(_at_)earthlink(_dot_)net*
************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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