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

RE: Calling functions from XSLTs


calling functions xslt
Thanks for the help folks.

I have another question. I am trying to transform instance of one schema
to an instance of another schema using XSLTs, but the problem is that
sometimes instead of an instance I have an XPath. How do I handle that? 

Example: I have to convert the following instance:  <abc>	
	
<name> Seattle </name>
	
<state> WA </state>
</abc>
into another instance  <xyz>	
				 <result> Seattle is in WA </result>
			     </xyz>

That's fairly simple to do, but in some cases I might get an XPath
/abc/[name=Seattle] and I need to convert this into the same schema,
(but with a different rule), so that the result will be
<xyz>
  <result> Seattle is a city</result>    // "is a city" is a constant
string
</xyz> 		
	
Is there any way to handle this?? One simple way I thought about was to
convert the XPath into a partial instance and then write the XSLT, but
this method runs into trouble the moment one has operators (AND, OR) in
the XPath. 

Thanks again
Amit

-----Original Message-----
From: Dare Obasanjo [mailto:dareo@m...] 
Sent: Monday, April 22, 2002 11:36 AM
To: Amit Rai; xml-dev@l...
Subject: RE:  Calling functions from XSLTs

In order to invoke self defined functions from within XSL stylesheet, 

 
1.You can add extension objects to XsltArgumentList and invoke any
methods on those from within your style sheet.

OR 

2.Use msxsl:script. There is no restriction on the namespaces you can
use inside msxsl:script.


However only certain namespaces are supported by default (i.e there is
no need to fully qualify the namespaces when using classes from these
namespaces). These are:- 

System
System.Collection 
System.Text
System.Text.RegularExpressions
System.Xml
System.Xml.Xslt
System.Xml.XPath
Microsoft.VisualBasic
 

Classes can still be used outside of the namespace, except that the name
must be namespace qualified. e.g. System.Diagnostics.Process 


-- 
PITHY WORDS OF WISDOM 
Your successes will happen in private and your failures in full view of
everyone. 
 
This posting is provided "AS IS" with no warranties, and confers no
rights. 
You assume all risk for your use. (c) 2002 Microsoft Corporation. All
rights reserved.



> -----Original Message-----
> From: Amit Rai [mailto:insouciant_23@h...] 
> Sent: Monday, April 22, 2002 10:59 AM
> To: xml-dev@l...
> Subject:  Calling functions from XSLTs
> 
> 
> Hi All,
> 
>  Is there any way of calling self defined functions from 
> within an XSLT code? AFAIK one can invoke 3 libraries through 
> .NET (using scripts) - System, System.XML and MSCoreLib. I 
> would like to access my own functions and datastructres from 
> within the scripts in XSLTs. Is there any way to do that?
> 
> Thanks
> amit
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 
<http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.