[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Fwd: Selecting First Child of Ancestor using Xpath


Subject: [xsl] Fwd: Selecting First Child of Ancestor using Xpath
From: Nathan Tallman <ntallman@xxxxxxxxx>
Date: Wed, 20 Nov 2013 10:12:32 -0500

I have the following xml:

               <c03 level="otherlevel" otherlevel="subsubseries"
id="seriesB2ii">
                  <did>
                     <unittitle>Section ii. Subject Files</unittitle>
                     <unitdate era="ce"
calendar="gregorian">1937-1958</unitdate>
                  </did>
                  <scopecontent>
                     <p>Scope and Content Note: Includes file on
Jewish organizations, annual
                        meetings, anti-discrimination and legislation,
Commentary newsletter,
                        Emergency Committee, foreign affairs, human
and civil rights, Israel, joint
                        defense appeal, Palestine immigration and
platform, peace, and the American
                        Jewish tercentenary.</p>
                  </scopecontent>
                  <arrangement>
                     <p>Arrangement Note: Arranged alphabetically.</p>
                  </arrangement>
                  <c04 level="file">
                     <did>
                        <container type="Box">B7</container>
                        <container type="Folder">30</container>
                        <unittitle>Administrative Committee</unittitle>
                        <unitdate era="ce"
calendar="gregorian">1943-1944</unitdate>
                     </did>
                  </c04>
                  <c04 level="file">
                     <did>
                        <container type="Box">B7</container>
                        <container type="Folder">31</container>
                        <unittitle>American Council for Judaism</unittitle>
                        <unitdate era="ce" calendar="gregorian">1950</unitdate>
                     </did>
                  </c04>
                  <c04 level="file">
                     <did>
                        <container type="Box">B7</container>
                        <container type="Folder">32</container>
                        <unittitle>American Jewish Conference</unittitle>
                        <unitdate era="ce"
calendar="gregorian">January - May 1943</unitdate>
                     </did>
                  </c04>

I'm working on a template that matches on c04, then has an
xsl:for-each for the did (so did is m context node). I am transforming
this into an HTML table.

I'd like to do an xsl:coose/when to test for the first c04 child of
c03, so I can add table headers. As this is processing all dids I need
the test to specifically catch the first c04 child. However
test="../../c04[1]" does not seem to be doing the trick.

Any suggestions? I'm using XSLT 2.0.

Thanks,
Nathan


Current Thread
Keywords