- <for-each select="$record-nodes[not(position()=last() or normalize-space(.)='')]">
- <variable name="fields" select="exslstr:tokenize(., '
')"/>
- <html:dl>
- <for-each select="$fields">
- <choose>
- <when test="starts-with(., ' ') and $fields[generate-id()=generate-id(current()/preceding-sibling::*[1])]"/>
- <otherwise>
- <variable name="next" select="following-sibling::*[not(starts-with(., ' '))]"/>
- <html:div>
- <html:dt>
- <value-of select="normalize-space(substring-before(., ':'))"/>
- </html:dt>
- <html:dd>
- <variable name="firstline">
- <choose>
- <when test="contains(., ':')">
- <value-of select="normalize-space(substring-after(., ':'))"/>
- </when>
- <otherwise>
- <value-of select="normalize-space(.)"/>
- </otherwise>
- </choose>
- </variable>
- <choose>
- <when test="substring($firstline, string-length($firstline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
- <value-of select="substring($firstline, 1, string-length($firstline)-1)"/>
- </when>
- <otherwise>
- <value-of select="$firstline"/>
- </otherwise>
- </choose>
- <for-each select="following-sibling::*[starts-with(., ' ') and not(preceding-sibling::*[generate-id()=generate-id($next)])]">
- <variable name="nextline" select="normalize-space(.)"/>
+ <for-each select="$record-separators">
+ <variable name="position" select="position()"/>
+ <variable name="prev-separator" select="$record-separators[($position)-1]"/>
+ <variable name="fields" select="$noshebang[following-sibling::*[generate-id()=generate-id(current())] and (not($prev-separator) or preceding-sibling::*[generate-id()=generate-id($prev-separator)])]"/>
+ <if test="$fields">
+ <html:dl>
+ <for-each select="$fields">
+ <choose>
+ <when test="starts-with(., ' ') and $fields[generate-id()=generate-id(current()/preceding-sibling::*[1])]"/>
+ <otherwise>
+ <variable name="next" select="following-sibling::*[not(starts-with(., ' '))]"/>
+ <html:div>
+ <html:dt>
+ <value-of select="normalize-space(substring-before(., ':'))"/>
+ </html:dt>
+ <html:dd>
+ <variable name="firstline">
+ <choose>
+ <when test="contains(., ':')">
+ <value-of select="normalize-space(substring-after(., ':'))"/>
+ </when>
+ <otherwise>
+ <value-of select="normalize-space(.)"/>
+ </otherwise>
+ </choose>
+ </variable>