Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2009, 09:39 PM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Determing the type of a variable..

All:

I've read through the forums. I've read through some different XSLT books. Either I'm not seeing what is right in front of me, or there is no way to do this...

How can I test a variable to determine if it is an RTF or node-set? I am writing some templates that others will import to use in their own stylesheets. So far so good, but I would like to be agnostic about what the user passes to my template... They could pass me one of several node-sets that contain the same kind of data (but structured differently), this is easy to accomodate... but where I'm getting stuck is.. what if they just pass me an RTF? I can't seem to test for this, no matter what I do the proc chokes with an invalid type error...

I would like to do something like if (type($variable) == rtf)) but clearly its not that easy.. and sadly we are stuck with xslt1.0 for at least another 18 months...

I did a search on fragment/rtf/result tree fragment and I didn't see any posts that directly addressed this question... so I'm hoping I am asking something obvious...
 
Old October 19th, 2009, 04:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't believe there is any standard way of doing this in XSLT 1.0.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old October 19th, 2009, 06:07 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

If your XSLT 1.0 processor has EXSLT support then that provides a function object-type http://www.exslt.org/exsl/functions/...ype/index.html
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong Required Item Type for variable.. ?? mphare XSLT 1 January 29th, 2009 06:06 PM
Setting variable to user defined type mantle51 SQL Server 2000 3 August 10th, 2007 03:52 AM
problem with variable data-type mlar XSLT 4 June 22nd, 2007 10:39 AM
declare a ASP variable with a TYPE crmpicco Classic ASP Basics 1 August 17th, 2005 05:52 PM
Determing which application has current focus marcmason Pro VB 6 2 August 14th, 2003 04:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.