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

Re: getting node type in xsl

Subject: Re: getting node type in xsl
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 7 Sep 2004 17:04:46 +0100
xsl node type
  unfortunately using asp.net I am bound to xslt version 1.0, as they
  will not implement version 2 even in the next version of their
  framework.
  or is there another .net xslt processor around, where I can leverage version2.0?


An alternative that would work in xslt1 (or a non-schema xslt2
processor) is to pre-process your schema using xslt to produce an xslt
file that "knows" the element types. If your schema is highly complex
this might be difficult but for many schema documents it is relatively easy
to write an xslt file that inputs a schema and (say) collects all the
element names that have type xsd:integer and outputs

<xsl:template mode="type" match="elem1|elem2|....|last-element">
 <xsl;text>integer</xsl:text>
</xsl:template>

then, having produced this xsl file you can import that into your main
xslt file and whenever you need to know the type of an element
just apply this type mode to get the type name of the current element.

<xsl:variable name="type">
 <xsl;apply-templates mode="type" select="."/>
</xsl:variable>
<xsl:if test="$type='integer'">
  do something about integers...

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.