xsl-list
[Top] [All Lists]

Displaying Code Dependent on First Encounter of Specific Reference

2004-10-13 13:57:37
XSL list:

I'm developing a stylesheet that converts XML to html to display research 
articles. The articles contains three citation types, bibliographical, table 
call, and figure call. Upon encountering a table call or figure call, I would 
like to display the table or figure referred to immediately following the 
paragraph that contains the call. I want the table or figure to appear in the 
order they were referred to in the paragraph and I want each table or figure to 
only appear once in the outputted document. Tables and figures are numbered in 
order of their reference, though at any point you can refer to a table or 
figure that has been previously called.

Citations look like this:
<xref ref-type="bibr" rid="B1">1</xref>
<xref ref-type="table" rid="T1">Table 1</xref>
<xref ref-type="fig" rid="F1">Figure 1</xref>

Sample Input:

[A paragraph that includes a citation for Table 1.]
[A paragraph that includes citations for Table 2, Table 1, Figure 1, and Table 
3.] 

Sample Output:

[A paragraph that includes a citation for Table 1.]

Table 1

[A paragraph that includes citations for Table 2, Table 1, Figure 1, and Table 
3.] 

Table 2
Figure 1
Table 3

 My initial thought is to create a set of keys:
Key: Last Table Processed
Key: Last Figure Processed
Key: Last Table Encountered
Key: Last Figure Encountered

Since the tables and figures are numbered in order, a comparison of the two 
keys should be in order. This comparison should be made at the end of 
processing a paragraph. However, I'm not quite sure how I'd make such a 
comparison or even if I can use keys in that manner. I'm thinking I might need 
to generate some sort of array to keep track of the multiple citations 
encountered so that in the sample provided the output is (Table 2, Figure 1, 
Table 3) and not (Table 2, Table 3, Figure 1) or (Figure 1, Table 2, Table 3). 
If I were to build an array, since at this point I don't need to process <xref> 
citations of "bibr" type, those should be ignored. Any suggestions would be 
greatly appreciated. Thanks.


- Joe



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