6
|
1 |
/*
|
|
2 |
* reserved comment block
|
|
3 |
* DO NOT REMOVE OR ALTER!
|
|
4 |
*/
|
|
5 |
/*
|
|
6 |
* Copyright 1999-2004 The Apache Software Foundation.
|
|
7 |
*
|
|
8 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9 |
* you may not use this file except in compliance with the License.
|
|
10 |
* You may obtain a copy of the License at
|
|
11 |
*
|
|
12 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13 |
*
|
|
14 |
* Unless required by applicable law or agreed to in writing, software
|
|
15 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17 |
* See the License for the specific language governing permissions and
|
|
18 |
* limitations under the License.
|
|
19 |
*/
|
|
20 |
/*
|
|
21 |
* $Id: FuncGenerateId.java,v 1.2.4.1 2005/09/14 20:18:45 jeffsuttor Exp $
|
|
22 |
*/
|
|
23 |
package com.sun.org.apache.xpath.internal.functions;
|
|
24 |
|
|
25 |
import com.sun.org.apache.xml.internal.dtm.DTM;
|
|
26 |
import com.sun.org.apache.xpath.internal.XPathContext;
|
|
27 |
import com.sun.org.apache.xpath.internal.objects.XObject;
|
|
28 |
import com.sun.org.apache.xpath.internal.objects.XString;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Execute the GenerateId() function.
|
|
32 |
* @xsl.usage advanced
|
|
33 |
*/
|
|
34 |
public class FuncGenerateId extends FunctionDef1Arg
|
|
35 |
{
|
|
36 |
static final long serialVersionUID = 973544842091724273L;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Execute the function. The function must return
|
|
40 |
* a valid object.
|
|
41 |
* @param xctxt The current execution context.
|
|
42 |
* @return A valid XObject.
|
|
43 |
*
|
|
44 |
* @throws javax.xml.transform.TransformerException
|
|
45 |
*/
|
|
46 |
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
|
|
47 |
{
|
|
48 |
|
|
49 |
int which = getArg0AsNode(xctxt);
|
|
50 |
|
|
51 |
if (DTM.NULL != which)
|
|
52 |
{
|
|
53 |
// Note that this is a different value than in previous releases
|
|
54 |
// of Xalan. It's sensitive to the exact encoding of the node
|
|
55 |
// handle anyway, so fighting to maintain backward compatability
|
|
56 |
// really didn't make sense; it may change again as we continue
|
|
57 |
// to experiment with balancing document and node numbers within
|
|
58 |
// that value.
|
|
59 |
return new XString("N" + Integer.toHexString(which).toUpperCase());
|
|
60 |
}
|
|
61 |
else
|
|
62 |
return XString.EMPTYSTRING;
|
|
63 |
}
|
|
64 |
}
|