Re: [xsl] Creating an input form, XML -> XSLT -> HTML

Subject: Re: [xsl] Creating an input form, XML -> XSLT -> HTML
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Sun, 30 Dec 2001 18:41:27 +0000
>I found an example in the archives dated 17 Oct 1999 23:49:15 from Clark Evans.
>The example is supposed to handle attributes as well as elements, but given
>this input:
> [snip]

I think there is a slightly more up to date version at
which sems to be from a follow-up to the message you quoted.  It has
an extra bit on the end to handle attributes.

However, the template that does the traversal only visits element
nodes, so that is all you get in the output.  To visit attribute nodes
too, try replacing the first template with:

<xsl:template match="@*|*">
<xsl:call-template name="resolver" />
<xsl:apply-templates select="@*|*" />


<xsl:template match="*">
   <xsl:for-each select="@*">
       <xsl:call-template name="resolver" />
   <xsl:call-template name="resolver" />

(same thing really, just different styles)

Note: watch out for the 'improvement' in the later version which uses
format-number to pad the positions to four digits.  As mentioned, it
will break should your input document go over 9999 nodes at any level.

I'm sure I have seen the same thing discussed on this list within the
last year, with a much more comprehensive solution - anyone else
remember it?

Trevor Nash
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:

Current Thread