Loading ...
Sorry, an error occurred while loading the content.

7251Creating an alpha index with sub heads

Expand Messages
  • Carolyn
    Aug 31, 2006
    • 0 Attachment
      I'm trying to create an alpha index from a number of xml files which
      is no problem but I need to get a sub heading in between each break of
      alpha characters.

      A
      Another part
      Anything here

      B
      Begin another part
      Being here

      etc.

      My xml that is being processed is a 'hub' file of sorts that
      references the files themselves as entities.

      Example:

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE firsttag [

      <!ENTITY graphic1 SYSTEM "graphic1.tif" NDATA tif>
      <!ENTITY graphic2 SYSTEM "graphic2.tif" NDATA tif>

      <!ENTITY xmlfile1 SYSTEM "xmlfile1.xml">
      <!ENTITY xmlfile2 SYSTEM "xmlfile2.xml">
      <!ENTITY xmlfile3 SYSTEM "xmlfile3.xml">
      <!ENTITY xmlfile4 SYSTEM "xmlfile4.xml">
      ]>
      <pm>
      <chapter>
      <subsystem>
      &xmlfile1;
      &xmlfile2;
      </subsystem>
      </chapter>
      <chapter>
      <subsystem>
      &xmlfile3;
      </subsystem>
      <subsystem>
      &xmlfile4;
      </subsystem>
      </chapter>
      </pm>

      The individual xml files are pretty basic:

      xmlfile1:

      <firsttag id="first1">
      <secondtag id="second1">
      <thirdtag id="third1">
      ...
      </thirdtag>
      </secondtag>
      <contenttag id="contenttag1">
      <step1>
      ...
      </step1>
      <partlisttag id="partlisttag1">
      <figure id="fig1">
      <title>Fig title</title>
      <graphic boardno="graphic1" id="graphic1"/>
      </figure>
      <parttag ind="0" item="0">
      <subparttag id="subparttag1>
      <qna>1</qna>
      <mfc>45165</mfc>
      <pnr hardware="0">123456</pnr>
      <pas>
      <dfp>Beging here</dfp>
      <pcs uom="EA"></pcs>
      </pas>
      ...
      </subparttag>
      <subparttag id="subparttag1>
      <qna>1</qna>
      <mfc>45165</mfc>
      <pnr hardware="0">476594</pnr>
      <pas>
      <dfp>Another part</dfp>
      <pcs uom="EA"></pcs>
      </pas>
      ...
      </subparttag>
      </parttag>
      <parttag>
      <subparttag id="subparttag1>
      <qna>1</qna>
      <mfc>45165</mfc>
      <pnr hardware="0">4765954</pnr>
      <pas>
      <dfp>Begin another part</dfp>
      <pcs uom="EA"></pcs>
      </pas>
      ...
      </subparttag>
      </parttag>
      ...
      <partlisttag>
      </contenttag>
      </firsttag>

      xmlfile2:

      <firsttag id="first1">
      <secondtag id="second1">
      <thirdtag id="third1">
      ...
      </thirdtag>
      </secondtag>
      <contenttag id="contenttag1">
      <step1>
      ...
      </step1>
      <partlisttag id="partlisttag1">
      <figure id="fig1">
      <title>Fig title</title>
      <graphic boardno="graphic1" id="graphic1"/>
      </figure>
      <parttag ind="0" item="0">
      <subparttag id="subparttag1>
      <qna>1</qna>
      <mfc>45165</mfc>
      <pnr hardware="0">84956</pnr>
      <pas>
      <dfp>Anything here</dfp>
      <pcs uom="EA"></pcs>
      </pas>
      ...
      </subparttag>
      </parttag>
      ...
      <partlisttag>
      </contenttag>
      </firsttag>

      I can get the alpha index with:
      <xsl:for-each
      select="descendant-or-self::firsttag//partlisttag//pnr[@hardware!='1']/following-sibling::pas/dfp">
      <xsl:sort select="."/>
      <fo:table-row>
      <fo:table-cell hyphenate="false" column-number="1">
      <fo:block>
      <xsl:value-of select="."/>
      </fo:block>
      </fo:table-cell>
      <fo:table-cell column-number="2" display-align="after">
      <fo:block>
      <fo:page-number-citation ref-id="{generate-id()}"/>
      </fo:block>
      </fo:table-cell>
      <fo:table-cell column-number="3" display-align="after">
      <fo:block text-align="left">
      <xsl:value-of select="ancestor::parttag/@item"/>
      </fo:block>
      </fo:table-cell>
      </fo:table-row>
      </xsl:for-each>

      How do I test the previous sorted description and not the previous
      descritpion element?

      I've tried, <xsl:if test=".=preceding::pas/dfp or
      preceding::firsttag//partlisttag//pas/dfp"> and various other tests
      but they're all looking at the document structure and not the previous
      sorted element.

      I'm using AntennaHouse XML Formatter 3.3. Sorry this is so long but I
      wanted to give as much info as I could. :)

      Carolyn
    • Show all 2 messages in this topic