xsl-list
[Top] [All Lists]

Re: [xsl] testing preceding sibling always evaluates true

2011-07-29 14:04:05
The code you've posted looks to me like it should work for the input
you show.  Obviously, there's more to it and we probably need to see
more of the transform and/or input.  If they're overly large, perhaps
you can create cut-down versions that still demonstrate the problem.
Often times, just going through that process can help to pinpoint the
real source of the problem.

-Brandon :)


On Fri, Jul 29, 2011 at 1:11 PM, Jeff Wilson
<jeffrey(_at_)backhousestudios(_dot_)com> wrote:
Good Morning,

I'm trying to test the first preceding-sibling of my match to determine what
type of table I'm formatting.

This is the XSL that is testing, but it always comes back true and all
tables are formatted as Numbered tables:

<xsl:template
match="/pkg:package/pkg:part/pkg:xmlData/w:document/w:body/w:tbl">
       <xsl:choose>
               <xsl:when
test="preceding-sibling::w:p[1]/w:pPr/w:pStyle[@w:val='TableCaption']">
                       <xsl:call-template name="NumberedTable"/>
               </xsl:when>
               <xsl:otherwise>
                       <xsl:call-template name="TabularText"/>
               </xsl:otherwise>
       </xsl:choose>
</xsl:template>

given this xml:
...
<w:p w14:paraId="69005124" w14:textId="77777777" w:rsidR="001D446A"
w:rsidRDefault="001D446A" w:rsidP="001D446A">
       <w:pPr>
               <w:pStyle w:val="TableCaption"/>
       </w:pPr>
       <w:r>
               <w:t>Table 14.1: External data formats Inventor can import or
export</w:t>
       </w:r>
</w:p>
<w:tbl>
...
...
<w:p w14:paraId="5EA14AF4" w14:textId="77777777" w:rsidR="001D446A"
w:rsidRDefault="001D446A" w:rsidP="001D446A">
       <w:pPr>
               <w:pStyle w:val="Para"/>
       </w:pPr>
       <w:r>
               <w:t>As you can see from the following tabular text:</w:t>
       </w:r>
</w:p>
<w:tbl>
...


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

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