[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Testing implicit XHTML hierarchy

Subject: Re: Testing implicit XHTML hierarchy
From: "bryan rasmussen" <rasmussen.bryan@xxxxxxxxx>
Date: Thu, 5 Jul 2007 02:18:25 +0200
Re:  Testing implicit XHTML hierarchy
obviously that should not be a following-sibling in there but just a following.


Cheers, Bryan Rasmussen

On 7/5/07, bryan rasmussen <rasmussen.bryan@xxxxxxxxx> wrote:
actually though, if it were me, I would probably prefer something
along the lines of

<xsl:template match="/">
<output>
<xsl:variable name="h"
select="//xhtml:*[matches(local-name(),'^h[1-6]')]"/>

<xsl:for-each select="$h">
<xsl:if test="number(substring-after(local-name(following-sibling::xhtml:*[1]),'h'))
&gt; (number(substring-after(local-name(),'h')) + 1)">
    section head jumped by more than one level
 </xsl:if>
</xsl:for-each>

</output>
</xsl:template>

which is probably not 100% correct, have not tested. (need to add in
the appropriate xhtml:h1 test anyway)

Cheers,
Bryan Rasmussen

On 7/5/07, bryan rasmussen <rasmussen.bryan@xxxxxxxxx> wrote:
> well i agree there is redundancy (damn I should really do this stuff
> instead of messing around )
>
> but
>
> <xsl:variable name="h"
> select="//xhtml:*[matches(local-name(),'^h[1-6]')]/number(substring(local-name(),2))"/>
>
> <xsl:for-each select="1 to count($h)-1">
> <result select="$h[.+1][1]">
>
> <xsl:value-of select="$h[.+1][1]"/>
> </result>
> <result select="$h[.][1]">
>
> <xsl:value-of select="$h[.][1]"/>
> </result>
> <result select="$h[.+1][2]">
> <xsl:value-of select="$h[.+1][2]"/>
> </result>
> <result select="$h[.][2]"><xsl:value-of select="$h[.][2]"/>
> </result>
> </xsl:for-each>
> </output>
> </xsl:template>
>
> produces
>
> <?xml version="1.0" encoding="UTF-8"?>
> <output>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
>    <result select="$h[.+1][1]">2</result>
>    <result select="$h[.][1]">1</result>
>    <result select="$h[.+1][2]">5</result>
>    <result select="$h[.][2]">2</result>
> </output>
>
> which I'm not following how $h[.+1][2] will always be empty?
>
> Since there are two items in the sequence I mean. Sorry if I'm not
> very clear right now, but I am not thinking especially sharpish.
>
> Cheers,
> Bryan Rasmussen
>
> On 7/5/07, David Carlisle <davidc@xxxxxxxxx> wrote:
> >
> > > actually  theres more than one item in your sequence that way.
> > I may have mistyped, but you shouldn't need the [1]'s  in for example
> > $h[.+1][1]
> > as $h[.+1] is %h[position()=.+1] so can return at most 1 item, so [1] is
> > redundant.
> > similarly $h[.+1][2] will always be empty.
> >
> > David
> >
> > ________________________________________________________________________
> > 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.
> > ________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.