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 http://www.dpawson.co.uk/xsl/sect2/N6052.html 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> or <xsl:template match="*"> <xsl:for-each select="@*"> <xsl:call-template name="resolver" /> </xsl:for-each> <xsl:call-template name="resolver" /> <xsl:apply-templates/> </xsl:template> (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? Regards, 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: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Creating an input form, X, Ron King | Thread | Re: [xsl] Creating an input form, X, Ron King |
[xsl] Re: Creating an input form, X, Dimitre Novatchev | Date | [xsl] Creating an input form, XML -, Dan Cederholm |
Month |