Print

Print


> off the top of my head, something along the lines of the expression
> 
>    if (starts-with(@next,'#')) then id (substring(@id,2)) else
>    doc(resolve-uri(@next,base-uri(.)))
> 
> but it's not easy

It may not be even as easy as that. The syntax of @next and @prev
allows leading or trailing whitespace, and 
   starts-with( @next, '#')
will fail on <quote next=" #a">.

I usually use
    <xsl:variable name="next" select="normalize-space( @next )"/>
and then test "starts-with( $next, '#' )".