usnationalarchives / federalregister-api-core

Federal Register 2.0 API and Data Importer
https://www.federalregister.gov
Other
136 stars 34 forks source link

GPO Tables XSLT #3

Closed ghost closed 6 years ago

ghost commented 11 years ago

Thank you for open-sourcing. I have found useful purposes for parts of your code... and have learned quite a bit as well.

Question: I used some of your GPOTABLES xslt code--with mostly good results. I still have problems with complex headers. For example your GPOTABLE XSLT will not translate this header correctly http://www.ecfr.gov/cgi-bin/text-idx?&node=7:7.1.2.8.5.5.162.10 Do you know how the people at ecfr.gov do it?

I've think I've narrowed down the problem to colspan setting in a header cell. For example, translating the table above, your XSLT comes up with an erroneous

<th colspan="15">Maximum limits of—</th> 

when the correct result should probably be

<th colspan="11">Maximum limits of—</th>

I think I traced the problem to the

<xsl:template name="header_cell">

..the problem might be this line

<xsl:variable name="descendants" select="following-sibling::CHED[@H &gt;1][count(preceding-sibling::CHED[@H = 1][1] | current()) = 1]"/>

I think the above code causes a second header row that spans a third header row to erroneously count as 2 columns spanned by header row 1. If that makes sense.

Or maybe I'm wrong.

I'm working to try and fix it myself. But the going is slow since I'm just learning XSLT, and this is pretty complex code to learn with.

It seems the ecfr people have solved it. But they might not have used xslt to do so.

..and I hope the sequester on Friday doesn't nuke this :)