CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    18

    Question How to apply template for the first w:p in w:tbl?

    Regardless of the nesting level in that particular w:tbl. For example:

    Code:
    <w:p w:rsidR="AAAAAA">
    </w:p>
    ...
    <w:tbl>
                <w:tblPr>
                    <w:tblStyle w:val="TableGrid"/>
                    <w:tblW w:w="0" w:type="auto"/>
                    <w:tblLook w:val="04A0"/>
                </w:tblPr>
                <w:tblGrid>
                    <w:gridCol w:w="2394"/>
                    <w:gridCol w:w="2394"/>
                    <w:gridCol w:w="2394"/>
                    <w:gridCol w:w="2394"/>
                </w:tblGrid>
                <w:tr w:rsidR="0065563E" w:rsidTr="0065563E">
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        
                        <w:p w:rsidR="000000000" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C11</w:t>
                            </w:r>
                        </w:p>
    
                    </w:tc>
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="11111111" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C12</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C13</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C14</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                </w:tr>
                <w:tr w:rsidR="0065563E" w:rsidTr="0065563E">
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C21</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C22</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C23</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                    <w:tc>
                        <w:tcPr>
                            <w:tcW w:w="2394" w:type="dxa"/>
                        </w:tcPr>
                        <w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
                            <w:r>
                                <w:t>C24</w:t>
                            </w:r>
                        </w:p>
                    </w:tc>
                </w:tr>

    In that case <w:p w:rsidR="11111111"> should be ignored as well as all consequentive <w:p>s inside of w:tbl at any nesting level. But <w:p w:rsidR="AAAAAA"> and <w:p w:rsidR="000000000" > must be processed. How to write it in select expression for xsl:template?

  2. #2
    Join Date
    Oct 2004
    Posts
    107

    Re: How to apply template for the first w:p in w:tbl?

    This depends on how you have set your templates up.

    Without any further knowledge of your code:
    Code:
    <xsl:template match="w:p">
    
    In your
    <xsl:template match="w:tbl">
    have
    <xsl:apply-templates select="(.//w:p)[1]"/>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured