XSLT error when trying to match an element that is following sibling of another element

Viewed 336

I'm having difficulty matching an element that is a following sibling of another element.

<w:p>
    <w:r>
        <w:rPr>
            <w:color w:val="002D56"/>
            <w:sz w:val="44"/>
            <w:szCs w:val="44"/>
        </w:rPr>
        <w:t>I want to match this...</w:t>
    </w:r>
    <w:r>
         <w:rPr>
             <w:rFonts w:cstheme="minorHAnsi"/>
             <w:sz w:val="28"/>
             <w:szCs w:val="28"/>
         </w:rPr>
         <w:t>...but I don't want to match this.</w:t>
    </w:r>
</w:p>

With

<xsl:template match="w:rPr[w:sz[@w:val='44']]"> ...

I'm finding the preceding sibling (the first w:rPr element in the sample above), but if I try

<xsl:template match="w:rPr[w:sz[@w:val='44']]/following-sibling::w:t"> ... 

I get an error that the pattern failed to compile (XSLTParseError: xsltCompilePattern : failed to compile).

I'm assuming the problem is with my XPath, but I can't figure out what. Suggestions?

2 Answers
Related