Subject: [xsl] reposting.extension library question From: "william locksman" <vsd18@xxxxxxxxxxxxxx> Date: 15 May 2002 14:53:14 -0000 |
<colors> <color>red</color> <color>blue</color> <color>green and pink</color> </colors>
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan = "http://xml.apache.org/xalan" exclude-result-prefixes="xalan" xmlns:java = "java"> <xsl:template match="/"> <xsl:for-each select="/colors/color"> <xsl:variable name="color" select="java:lang.String.new(.)"/> from java: <xsl:value-of select="java:toUpperCase($color)"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
where we instantiate the String object by saying java:lang.String.new() and then call the toUpperCase Method on that string. thaz fine.
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan = "http://xml.apache.org/xalan" exclude-result-prefixes="xalan" xmlns:str-utils = "com.xyz.StrUtils" extension-element-prefixes ="str-utils" > <xsl:template match="/"> <xsl:for-each select="/colors/color"> <xsl:variable name="color" select="."/> <xsl:value-of select="str-utils:upperCase($color)"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
This works fine too. My question is that in my Example, where is the instantiation being done?? I have not done anything like com.xyz.StrUtils.new()... so how is it working?? what is the theory behind the object instantiation when it comes to extension libraries??
/** * Constructor for the StringUtils object */ public StringUtils() { }
public String upperCase(String str) { return "str.toUpperCase() "+str.toUpperCase(); } }
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Namespace declarations in, Stuart Celarier | Thread | RE: [xsl] reposting.extension libra, David Nelson |
[xsl] Namespace declarations in the, Mia Chase | Date | Re: [xsl] Document() and &, longjohn |
Month |