xsl-list
[Top] [All Lists]

Re: [xsl] Testing implicit XHTML hierarchy

2007-07-04 17:13:37


me> I may have mistyped, but you shouldn't need the [1]'s

two true statements

me>   in for example $h[.+1][1]
me> as $h[.+1] is %h[position()=.+1] so can return at most 1 item,

a statement that's not quite as true as one might wish...

I don't want to index with . (the value on the sequence) but with
current() the index value coming from the for-each, if I use current()
my statement that you only get one item is true and the code  works (I
claim)

even ran it past saxon this time:-0

sorry about that.

David


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xhtml="http://www.w3.org/1999/xhtml";>
  
<xsl:variable name="h"
select="//xhtml:*[matches(local-name(),'^h[1-6]')]/number(substring(local-name(),2))"/>

<xsl:template match="/">
<xsl:if test="not($h[1]=1 and count($h[.=1])=1)">h1 not right</xsl:if>
<xsl:for-each select="1 to count($h)-1">
  <xsl:if test="$h[current()+1]-$h[current()] gt 1">
     section head jumped by more than one level
  </xsl:if>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--