OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Calling functions from XSLTs

[ Lists Home | Date Index | Thread Index ]

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@microsoft.com] 
Sent: Monday, April 22, 2002 11:36 AM
To: Amit Rai; xml-dev@lists.xml.org
Subject: RE: [xml-dev] 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@hotmail.com] 
> Sent: Monday, April 22, 2002 10:59 AM
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] 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>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS