473,408 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

how to create a DocumentFragment in Xalan java extension function?

Hello,

I'm using Xalan and have written Java classes as extension functions.

According the documentation the return value of an extension function
can be a Result tree fragment: (== org.w3c.doc.DocumentFragment)

Now I can't figure out how to create an empty DocumentFragment from a
Java class that has been created in an XSL stylesheet

This is what I have so far:

public Object toSVG( ExpressionContext context)
{
Object retval;

try
{
Node node = context.getContextNode();
Document doc = node.getOwnerDocument();
DocumentFragment fragment = doc.createDocumentFragment();

Element text = doc.createElement( "text");
text.setPrefix( "svg");
text.setAttribute( "font-size", "2");
text.setAttribute( "transform", this.Transform());
text.setAttribute( "x", Double.toString( this.X()));
text.setAttribute( "y", Double.toString( this.Y()));
fragment.appendChild( text);
fragment.appendChild( bijpijling);

retval = fragment;
}
catch( DOMException e)
{
String error = Integer.toString( e.code);
Debug.Msg( 10, "error: " + error);
retval = error;
}

return( retval);
}

example usage (simplified)

<xsl:variable name="Tekst" select="map:TText.new( "aText")/>
<svg:a xlink:href="{$url}">
<xsl:for-each select="map:toSVG( $Tekst)">
<xsl:copy-of select="." />
</xsl:for-each>
</svg:a>
Jul 20 '05 #1
0 2211

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: al dav | last post by:
Hi all ok i am not a java programmer I am a sys-admin, my users want xalan and have already got j2sdk_1.4.2 so i have downloaded it and set the CLASS_PATH export...
0
by: Andy Fish | last post by:
Hi I am using Xalan-J 2.4.1 and I am trying to get the EXSLT node-set function working. xalan:nodeset() works fine but when I try exslt:node-set I get this error: (Location of error...
0
by: Chris Bedford | last post by:
Hello, I'm using Xalan and I have a bunch of xslt documents that were constructed to run with another processor that has alot of custom extension functions. The names of these functions ...
0
by: bastien | last post by:
Hi all I get an xml file which refer to a xsl file . this xsl refer to others xsl files. I use xalan to do the transformation xml+xsl=>html but we I launch xalan *I get an error: ...
1
by: Fisch von Gestern | last post by:
I have tried to run the extension function/element examples provided with the Xalan-J download. I believe that my classpath is correct, and that my versions are up-to-date. However, I can't get...
6
by: Robbie Baldock | last post by:
Hi - I'm a bit of a newbie to the world of XSLTs but am trying to call a Java method on a parameter passed into an XSLT but am having problems. I've stripped the XSLT down to its bare bones: ...
7
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
2
by: henribastien | last post by:
I'm trying to return an array from a xalan extension but so far I have made no progress. What I would like to return is something like that <entry id="red">201</entry> <entry...
3
by: =?iso-8859-1?q?Eduardo_Y=E1=F1ez_Parareda?= | last post by:
Hello, I have to use xalan to transform some XML using XSL, but I have some problems within the XSLs, and Xalan doesn't give very good error messages. Is there any way to put Xalan on debug or...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.