This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>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@melvaig.co.uk

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]