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

Re: [xsl] Looking for "real-world" XML documents


Subject: Re: [xsl] Looking for "real-world" XML documents
From: "Syd Bauman s.bauman@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Nov 2014 02:14:35 -0000

> >  * The voting record of the United States Senate in XML is quite a
> >    pain to find; e.g.:
> >    http://www.senate.gov/legislative/LIS/roll_call_votes/vote1122/vote_112_2_00172.xml
> 
> How to locate the repository where all such vote documents reside?
> This will be handy if we want to analyze/process a set of documents
> by using, for example, the collection() function.

Here is an extract from a stylesheet I wrote to do some crunching on
Senate votes for the 111th and 112th congress. (Don't know why I was
selecting only votes 100 to 200.) Suggested improvements welcome.

  <xsl:variable name="base" select="'http://www.senate.gov/legislative/LIS/roll_call_votes/vote'"/>
  <xsl:template match="/">
    <xsl:for-each select="111 to 112">
      <xsl:variable name="congress" select="."/>
      <xsl:for-each select="1 to 2">
        <xsl:variable name="session" select="."/>
        <xsl:for-each select="100 to 200">
          <xsl:variable name="vote" select="format-number( . cast as xs:integer, '00000') cast as xs:string"/>
          <xsl:variable name="URI" select="concat($base,$congress,$session,'/vote_',$congress,'_',$session,'_',$vote,'.xml')"/>
          <xsl:variable name="roll_call_vote" select="document( $URI)/roll_call_vote"/>
          <xsl:apply-templates select="$roll_call_vote">
            <xsl:with-param name="congress" select="$congress"/>
            <xsl:with-param name="session" select="$session"/>
            <xsl:with-param name="vote" select="$vote"/>
          </xsl:apply-templates>
        </xsl:for-each>
      </xsl:for-each>
    </xsl:for-each>
  </xsl:template>


Current Thread
Keywords
xml