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

Re: Determining the type of items in a sequence

Subject: Re: Determining the type of items in a sequence
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Mar 2013 18:36:21 -0400
Re:  Determining the type of items in a sequence
At 2013-03-11 18:31 -0400, Wendell Piez wrote:
Could someone please remind me the most graceful way in XPath 2.0 of
determining dynamically whether any arbitrary $n is bound to a node or
sequence of nodes (i.e., no atomic values)?

instance of node()*


There's some furious parameterization going on and I just can't
remember this. (It's not the kind of thing easy to search for either.)

Not sure what you are referring to regarding parameterization.


I hope the illustration below helps.

. . . . . . . . Ken

t:\ftemp>type wendell.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">

<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:variable name="test1" select="doc(''),doc('')/*/xsl:*"/>
  <xsl:value-of select="count($test1),$test1 instance of node()*,'&#xa;'"/>
  <xsl:variable name="test2" select="$test1,'hello',$test1"/>
  <xsl:value-of select="count($test2),$test2 instance of node()*,'&#xa;'"/>
</xsl:template>

</xsl:stylesheet>
t:\ftemp>xslt2 wendell.xsl wendell.xsl
3 true
7 false

t:\ftemp>


-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Apr 2013 | Contact us for world-wide XML consulting and instructor-led training | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: https://plus.google.com/116832879756988317389/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |

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.