[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: determining whether an XPATH points to an element
> Sorry I was a bit unclear. ah the second version was clearer but still... want to generate the following template match rule for an XPATH pointing to a element <xsl:template match="//tagname"> <TagOperation> Note that prefixing a match expression with // never does anything except perhaps change the default priority. match="//tagname" matches the same elements as match="tagname" and <xsl:template match="@attributename"> matches the same attributes as <xsl:template match="//@attributename"> Going back to your first message.. <xsl:template match="//tagname"> <xsl:choose> <xsl:when test=" current() = some sort of test "><!-- if it points to element --> in this case the template only matches elements. If you really want a template that matches both elements and attributes you need to do something like <xsl:template match="tagname|@tagname"> Then you can tell if you have an element or an attribute by <xsl:if test="self::*">which is true just on element nodes but this is a rather strange thing to do as 999 times out of 1000 you always know in a template what kind of node is being matched. David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|