Problems during Transformation using Xalan
Hi,
i'm using Xalan 2.6.0 to transform xml and xsl into HTML.
This works fine but i get errors during Transformation but the HTML File is build.
The Error is:
[Error] version.xsl:9:80: Element type "xsl:stylesheet" must be declared.
[Error] version.xsl:11:33: Element type "xsl:include" must be declared.
[Error] version.xsl:20:3: Element type "xsl:output" must be declared.
[Error] version.xsl:21:25: Element type "xsl:template" must be declared.
[Error] version.xsl:22:7: Element type "html" must be declared.
[Error] version.xsl:23:34: Element type "xsl:call-template" must be declared.
[Error] version.xsl:24:79: Element type "xsl:with-param" must be declared.
[Error] version.xsl:26:7: Element type "body" must be declared.
[Error] version.xsl:27:83: Element type "table" must be declared.
[Error] version.xsl:28:7: Element type "tr" must be declared.
[Error] version.xsl:29:34: Element type "th" must be declared.
[Error] version.xsl:32:64: Element type "table" must be declared.
[Error] version.xsl:33:7: Element type "tr" must be declared.
. and so on
The header of the XSL File looks like:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY amp "&">
<!ENTITY nbsp " ">
<!ENTITY uuml "ü">
<!ENTITY Auml "Ä">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:include href="global.xsl"/>
<!-- Template f�r root Element-->
<xsl:output
method="html"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
encoding="ISO-8859-1"
version="4.01"
indent="yes"
/>
<xsl:template match="/">
Can somebody help me with this problem ?
Thanks.
Jens
When I remove the DOCTYPE it works but is this a Xalan Problem or is the using of a doctype declaration in a XSL Document generally forbidden ?
Because without Doctype i cant use characters such as "�", "�", and so on.
Similar Messages
-
Problem During Importing using DBMS_DATAPUMP
Hi,
I am facing Problems while Importing usinf DBMS_DATAPUMP:
Its not showing any Error but the Tables not getting Imported.
Below is the Code whihc i have written for Import:
CREATE OR REPLACE PROCEDURE Data_Pump_Import_Load AS
ind NUMBER; -- Loop index
h1 NUMBER; -- Data Pump job handle
percent_done NUMBER; -- Percentage of job complete
job_state VARCHAR2(30); -- To keep track of job state
le ku$_LogEntry; -- For WIP and error messages
js ku$_JobStatus; -- The job status from get_status
jd ku$_JobDesc; -- The job description from get_status
sts ku$_Status; -- The status object returned by get_status
BEGIN
-- Create a (user-named) Data Pump job to do a schema export.
DBMS_OUTPUT.PUT_LINE('COMES HERE');
h1 := DBMS_DATAPUMP.OPEN(operation => 'IMPORT', job_mode =>
'TABLE',job_name => 'RET_IMPORT_TEST');
DBMS_OUTPUT.PUT_LINE('COMES HERE1111');
DBMS_DATAPUMP.ADD_FILE(handle => h1,filename =>
'MYEXPORTTEST.DMP', DIRECTORY => 'EXPORT_DIR',filetype=>1);
DBMS_OUTPUT.PUT_LINE('COMES HERE2222');
DBMS_DATAPUMP.ADD_FILE(handle => h1,filename =>
'MYEIMPORTTEST.LOG',DIRECTORY => 'EXPORT_DIR',filetype=>3);
DBMS_DATAPUMP.SET_PARAMETER (handle => h1,
NAME => 'INCLUDE_METADATA',
VALUE => 1);
DBMS_DATAPUMP.SET_PARAMETER(handle => h1,NAME =>
'DATA_ACCESS_METHOD', VALUE =>'AUTOMATIC');
DBMS_DATAPUMP.SET_PARAMETER(handle => h1,NAME =>
'TABLE_EXISTS_ACTION', VALUE =>'REPLACE');
DBMS_OUTPUT.PUT_LINE('COMES HERE3333');
-- Specify a single dump file for the job (using the handle just returned)
-- and a directory object, which must already be defined and accessible
-- to the user running this procedure.
-- Start the job. An exception will be generated if something is not set up
-- properly.
DBMS_DATAPUMP.START_JOB(h1);
-- The export job should now be running. In the following loop, the job
-- is monitored until it completes. In the meantime, progress information is
-- displayed.
percent_done := 0;
job_state := 'UNDEFINED';
WHILE (job_state != 'COMPLETED') AND (job_state != 'STOPPED') LOOP
dbms_datapump.get_status(h1,
dbms_datapump.ku$_status_job_error +
dbms_datapump.ku$_status_job_status +
dbms_datapump.ku$_status_wip,-1,job_state,sts);
js := sts.job_status;
-- If the percentage done changed, display the new value.
IF js.percent_done != percent_done
THEN
DBMS_OUTPUT.PUT_LINE('*** Job percent done = ' ||
TO_CHAR(js.percent_done));
percent_done := js.percent_done;
END IF;
-- If any work-in-progress (WIP) or error messages were received for the job,
-- display them.
IF (BITAND(sts.mask,dbms_datapump.ku$_status_wip) != 0)
THEN
le := sts.wip;
ELSE
IF (BITAND(sts.mask,dbms_datapump.ku$_status_job_error) != 0)
THEN
le := sts.error;
ELSE
le := NULL;
END IF;
END IF;
IF le IS NOT NULL
THEN
ind := le.FIRST;
WHILE ind IS NOT NULL LOOP
DBMS_OUTPUT.PUT_LINE(le(ind).LogText);
ind := le.NEXT(ind);
END LOOP;
END IF;
END LOOP;
-- Indicate that the job finished and detach from it.
DBMS_OUTPUT.PUT_LINE('Job has completed');
DBMS_OUTPUT.PUT_LINE('Final job state = ' || job_state);
dbms_datapump.detach(h1);
END;
/Use metadata_remap proc with REMAP_SCHEMA option:
DBMS_DATAPUMP.METADATA_RAMAP(id, 'REMAP_SCHEMA', 'SOURCE_SCHEMA', 'DESTINATION_SCHEMA'); -
Namespace lost when transforming using Xalan
Hi Java experts,
I'm trying to output a DOM object to a file. I used Xerces to create the DOM object:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
docBuilder.setErrorHandler(new MyErrorHandler());
this.userPrefsDocument = docBuilder.newDocument();
this.userPrefsRootNode = this.userPrefsDocument.getDocumentElement();
if (this.userPrefsRootNode == null) {
this.userPrefsRootNode = this.userPrefsDocument.createElementNS(
ROOTNAMESPACE, "ROOT");
this.userPrefsDocument.appendChild(this.userPrefsRootNode);
System.out.println(this.userPrefsRootNode.getNamespaceURI());
When I do this, the namespace is printed out (the same as ROOTNAMESPACE). Now, when I transform this using the following, the namespace is all lost in the output XML file:
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
DOMSource source = new DOMSource(this.userPrefsDocument);
StreamResult result = new StreamResult(SETTINGSLOCATION);
transformer.transform(source, result);
What I get is the following:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT/>
What I want to get is the following:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.blahblah.com/"/>
I know I could easily resolve this with a:
this.userPrefsRootNode.setAttribute("xmlns", ROOTNAMESPACE);
but, since I'm setting the namespace on the root element, and enabling namespace for the parser, I thought this would kind of "automagically" get included when performing a transform(). Or, is this what everyone does to enable namespacing in XML? Thanks in advance!OK, this is what I tried:
try {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element root = doc.getDocumentElement();
root = doc.createElementNS("http://www.abcdefg.com",
"myapp:ROOT");
doc.appendChild(root);
System.out.println(root.getNamespaceURI());
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File(System
.getProperty("user.home")
+ "/.myapp.xml"));
transformer.transform(source, result);
} catch (Exception e) {
e.printStackTrace();
The result I get is:
<?xml version="1.0" encoding="UTF-8"?>
<myapp:ROOT/>
Which is still not what I'm really looking for... I guess it's just easier to move to dom4j rather than wrestling around with DOM :P -
Toplink 11.1.1.1.0 Locking problem during update using ServerSession
Hi,
I m using toplink as ORM tool in my project. I have a scenario wherein I m using ServerSession and acquiring UnitOfWork. I do locking on the orm entity using following code.
ExpressionBuilder builder = new ExpressionBuilder();
Expression expr = builder.get("id").equal(id);
Employee employee = (Employee )uow.readObject(Employee .class, expr);
try {
uow.refreshAndLockObject(employee, ObjectLevelReadQuery.LOCK_NOWAIT);
} catch (Exception e){
throw new LockedException(); //Custom exception
The execution fails with the following error details.
Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070428)): oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification
Error Code: 1747
Call:SELECT ID, UDF_VALUE_20, UDF_VALUE_21, CATEGORY FROM EMPLOYEE WHERE (ID = 20001) FOR UPDATE OF * NOWAIT
Query:ReadObjectQuery(com.ofss.elcm.domain.ge.Liability)
at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:290)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:581)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:441)
at oracle.toplink.publicinterface.Session.executeCall(Session.java:728)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:117)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:103)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.selectOneRow(DatasourceCallQueryMechanism.java:501)
at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectOneRowFromTable(ExpressionQueryMechanism.java:862)
at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectOneRow(ExpressionQueryMechanism.java:837)
at oracle.toplink.queryframework.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:415)
at oracle.toplink.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:811)
at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:620)
at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:779)
at oracle.toplink.queryframework.ReadObjectQuery.execute(ReadObjectQuery.java:388)
at oracle.toplink.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:836)
at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2604)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:993)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:950)
at oracle.toplink.publicinterface.Session.refreshAndLockObject(Session.java:2632)
However if I load the UnitOfWork using DatabaseSession it works fine and build the query like this.
SELECT ID, UDF_VALUE_20, UDF_VALUE_21, CATEGORY FROM EMPLOYEE WHERE (ID = 20001) FOR UPDATE NOWAIT
Thanks in Advance.
SriniHi Chris,
Yes you are right, databasePlatform is set in the sessions.xml. However I have created two sessions.xml one for database session and the other for server session. In both the cases the file content is same except for session name.
database-session.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="Cp1252"?>-->
<toplink-sessions version="11g Release 1 (11.1.1.1.0)" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session xsi:type="server-session">
<name>database-session</name>
<event-listener-classes/>
<logging xsi:type="toplink-log">
<log-level>finest</log-level>
</logging>
<primary-project xsi:type="xml">META-INF/employee.xml</primary-project>
<login xsi:type="database-login">
<platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
<!--<external-connection-pooling>true</external-connection-pooling>
--><!-- Thru Junit Testing -->
<user-name>Test1</user-name>
<password>Test1</password>
<sequencing>
<default-sequence xsi:type="table-sequence">
<name>Default</name>
<preallocation-size>100</preallocation-size>
</default-sequence>
</sequencing>
<!-- Thru Junit Testing -->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@testDB:1521:ORCL</connection-url>
<!--<datasource lookup="string">jdbc/TestDataSource</datasource>
--></login>
<connection-pools>
<read-connection-pool>
<name>ReadConnectionPool</name>
</read-connection-pool>
<write-connection-pool>
<name>default</name>
</write-connection-pool>
</connection-pools>
<connection-policy/>
</session>
</toplink-sessions>
server-session.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="Cp1252"?>-->
<toplink-sessions version="11g Release 1 (11.1.1.1.0)" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session xsi:type="server-session">
<name>server-session</name>
<event-listener-classes/>
<logging xsi:type="toplink-log">
<log-level>finest</log-level>
</logging>
<primary-project xsi:type="xml">META-INF/employee.xml</primary-project>
<login xsi:type="database-login">
<platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
<!--<external-connection-pooling>true</external-connection-pooling>
--><!-- Thru Junit Testing -->
<user-name>Test1</user-name>
<password>Test1</password>
<sequencing>
<default-sequence xsi:type="table-sequence">
<name>Default</name>
<preallocation-size>100</preallocation-size>
</default-sequence>
</sequencing>
<!-- Thru Junit Testing -->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@testDB:1521:ORCL</connection-url>
<!--<datasource lookup="string">jdbc/TestDataSource</datasource>
--></login>
<connection-pools>
<read-connection-pool>
<name>ReadConnectionPool</name>
</read-connection-pool>
<write-connection-pool>
<name>default</name>
</write-connection-pool>
</connection-pools>
<connection-policy/>
</session>
</toplink-sessions>
And I m loading the xmls uring singleton java class.
import java.io.IOException;
import oracle.toplink.exceptions.TopLinkException;
import oracle.toplink.sessions.DatabaseSession;
import oracle.toplink.threetier.ServerSession;
import oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader;
import oracle.toplink.tools.sessionmanagement.SessionManager;
* This class represents the DBSessionManager. This class will be responsible
* for creating the server session and multiple client session. The server session
* would be loaded from sessions.xml file and the client session will be created
* on the server session but the client session would use the external connection
* to make the transactions, it would not use the connection that is being created
* during loading the server session.
* @author
public class DBSessionManager {
* This attribute will hold the value for DBSession Manager.
private static DBSessionManager instance;
* This attribute will hold the value for session file path
private static final String SERVER_SESSIONS_XML = "META-INF/server-sessions.xml";
private static final String DATABASE_SESSIONS_XML = "META-INF/database-sessions.xml";
private static final String DATABASE_SESSION = "database-session";
private static final String SERVER_SESSION = "server-session";
* This attribute will hold the value for session file
private String serverSessionConfigLocation = SERVER_SESSIONS_XML;
* This attribute will hold the value for session file
private String databaseSessionConfigLocation = DATABASE_SESSIONS_XML;
* This attribute will hold the value for session name.
private static final String DEFAULT_SESSION_NAME = "default";
* This attribute will hold the value for session name
private String sessionName = SERVER_SESSION;
private boolean standalone = false;
private static Session toplinkSession = null;
* This is attribute which tell the session type<br>
* Supported values are
* <li> DATABASE is DatabaseSession </li>
* <li> SERVER is ServerSession </li>
private static final String TOPLINK_SESSION_TYPE = "TOPLINK_SESSION_TYPE";
* Default Constructor.
* This constructor will create the server session.
// private DBSessionManager() {
// // setSessionType();
// toplinkSession = new Session();
// if(standalone) {
// toplinkSession.setDatabaseSession(buildDatabaseSession());
// } else {
// ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// toplinkSession.setServerSession((ServerSession) buildServerSession(this.configLocation, this.sessionName, classLoader));
private DBSessionManager() {
// setSessionType();
toplinkSession = new Session();
toplinkSession.setDatabaseSession(buildDatabaseSession());
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
toplinkSession.setServerSession((ServerSession)buildServerSession(this.serverSessionConfigLocation, this.sessionName,classLoader));
* This method will return the instance of DBSessionManager class.
* @return
public static DBSessionManager getInstance() {
if (instance == null) {
synchronized (DBSessionManager.class) {
if (instance == null) {
instance = new DBSessionManager();
return instance;
public boolean isStandalone() {
return standalone;
* This method will load the server session from the sessions.xml file.
* @param configLocation
* @param sessionName
* @param sessionClassLoader
* @return ServerSession
* @throws TopLinkException
private ServerSession buildServerSession(String configLocation,
String sessionName,
ClassLoader sessionClassLoader) throws TopLinkException {
ServerSession serverSession =
(ServerSession)SessionManager.getManager().getSession(new XMLSessionConfigLoader(SERVER_SESSIONS_XML),
SERVER_SESSION,
// Session name
this.getClass().getClassLoader(), false, // shouldLoginSession
false, // shouldRefreshSession
true) // shouldCheckClassLoader
serverSession.login();
return serverSession;
* Use to get server session
* @return ServerSession
private ServerSession getServerSession() {
return toplinkSession.getServerSession();
* This method is used to release client session. The client session should<br>
* be released so that the server does not hang refusing new client session<br>
* requests. <br>
* It has been observed in local setups that the server hangs after firing<br>
* 30 to 40 requests even in a single thread if the client session is not<br>
* released.
* @param clientSession
public void releaseClientSession() {
toplinkSession.releaseClientSession();
private DatabaseSession buildDatabaseSession() {
XMLSessionConfigLoader loader =
new XMLSessionConfigLoader(DATABASE_SESSIONS_XML);
SessionManager sessionManager = SessionManager.getManager();
DatabaseSession session =
(DatabaseSession)sessionManager.getSession(loader, DATABASE_SESSION,
DBSessionManager.class.getClassLoader(),
true, true, true);
// SessionLog log = new TopLinkLog();
// Do not change the log level here. SessionLog.FINE logs DML statements
// and few other 'nonsenses'. DML statements are enough to debug an
// issue. All TopLink logs are logged as debug messages by LogUtil.
// log.setLevel(SessionLog.FINE);
return session;
public Session getSession() {
return toplinkSession;
* This method read the session type from elcm.properties and set the value for standalone attribute.<br>
* If the session is type of database the value is true, if the session is server session the value is false.
private void setSessionType() {
try {
String sessionType =
ELCMApplicationGlobals.getInstance().getProperty(TOPLINK_SESSION_TYPE);
if (DATABASE_SESSION.equalsIgnoreCase(sessionType)) {
standalone = true;
} else if (SERVER_SESSION.equalsIgnoreCase(sessionType)) {
standalone = false;
} catch (IOException e) {
e.printStackTrace();
Please review and let me know if I m missing anything or wrongly implemented.
Thanks,
Srini -
Problem during extraction using generic data sources
Hi
While performing extraction(master data) using generic data sources I am getting a problem.
while selecting application component, I am unable to find SD to select it.What should I do?
I selected CRM as application component and did the extraction , it is successful.
But what about if we want to select SD? I am guessing it as an installation problem ... Anyone plz help me
Thank you
DeepthiHi Deepthi,
Looks like the RFC connection between source system and BW system is broken..
Contact your basis team to check the connection what went wrong.
once the connection is re-established you can gohead ...
Try out this procedure
Type Transaction SM59.
a.) Open the RFC Destinations.
b.) Find your Source System and double click on it.
c.) Technical setting should contain information regarding your source
system
d.) Logon Information should contain source system client and name &
password for you remote logon.
**Suggestion : our remote name for our R/3 was ALEREMOTE. We use
BWREMOTE so that we can monitor without confusion.
e.) Execute your 'Test Connection' & 'Remote Logon'. You connection
should be You should NOT be prompted for a password.
f.) Repeat above to verify RFCs for other systems
regards
KP
Edited by: KP on Dec 14, 2009 12:11 PM -
Infoobject routine problem in transformation using BI 7.0 datasource
Hi expert,
We have the business senario:need to look up data from Active data of DSO: /BIC/AZIN_O0100 into infoobject ZN1 in DSO:AAA through the link ZNR. We have the code, but after DTP, there are blank value in infoobject ZN1 in the content of DSO:AAA. Anyone can guide us why we get the blank in the value.
DSO:AAA
ZNR;ZN1
Source field
ZNR;
Active data /BIC/AZIN_O0100
/BIC/ZNR;/BIC/ZN1
Code in routine of infoobject ZN1 in transformation (BI 7.0 datasource)
DATA: IT_ZN1 TYPE /BIC/AZIN_O0100-/BIC/ZN1.
SELECT /BIC/ZN1 INTO IT_ZN1 FROM /BIC/AZIN_O0100
WHERE /BIC/ZNR = SOURCE_FIELDS-ZNR.
ENDSELECT.
RESULT = IT_ZN1.Hi ,
Please split this code in start routine and transformation routine.
DSO:AAA
ZNR;ZN1
Source field
ZNR;
Start Routine
Active data /BIC/AZIN_O0100
/BIC/ZNR;/BIC/ZN1
DATA: IT_ZN1 TYPE /BIC/AZIN_O0100-/BIC/ZN1.
SELECT /BIC/ZN1 FROM /BIC/AZIN_O0100 INTO IT_ZN1
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE /BIC/ZNR = <SOURCE_FIELDS>-ZNR.
Transformation Routine
READ TABLE IT_ZN1 with key
/BIC/ZNR = <SOURCE_FIELDS>-ZNR BINARY SEARCH.
IF sy-subrc = 0.
RESULT = IT_ZN1 - FIELDNAME.
Hope this answres you.
-Vikram
RESULT = IT_ZN1. -
ClassCastException when using Xalan-j in a servlet
Hi,
New to XSLT and Xalan...
When I run a standalone version of a basic XSL transformation using Xalan-j 2.6.0, it all works as desired. Take a look at the following code snippet :
ByteArrayOutputStream out;
Document document;
DocumentBuilder builder;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
File stylesheet = new File(context.getRealPath("/xml/duties2Email.xsl"));
File datafile = new File(context.getRealPath("/xml/hospitals.xml"));
StreamResult result;
StreamSource stylesource;
StreamSource datasource;
String date = (new SimpleDateFormat("dd/MM")).format(new Date());
Transformer transformer;
TransformerFactory tFactory;
out = new ByteArrayOutputStream(500);
builder = factory.newDocumentBuilder();
tFactory = TransformerFactory.newInstance();
stylesource = new StreamSource(stylesheet);
transformer = tFactory.newTransformer(stylesource);
datasource = new StreamSource(datafile);
result = new StreamResult(out);
transformer.setParameter("date", date);
transformer.transform(datasource, result);Unfortunately, when I try to run a servlet with exactly the same code, it throws a ClassCastException, please view the following stack trace:
java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMManagerDefault
at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
at org.apache.xpath.XPathContext.<init>(XPathContext.java:87)
at org.apache.xalan.transformer.TransformerImpl.<init>(TransformerImpl.java:370)
at org.apache.xalan.templates.StylesheetRoot.newTransformer(StylesheetRoot.java:159)
at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:674)
at lu.etat.protex.duties.servlet.DutiesControllerServlet.sendEmails(Unknown Source)
at lu.etat.protex.duties.servlet.DutiesControllerServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
Does anybody know where the mistake could come from ?
Thanks in advance,
Régis KuckaertzTurned out that I had a version of xsltc.jar in my WEB-INF/lib. When I removed it the problem went away.So I'm sure it had to do with a library mismatch. I am using JBoss 4.1.
-Rich -
Hi,
Being very disappointed with the Xalan performance, I decided to try XT with the application I'm currently working on.
Unfortunately, I'm getting a DomException:
org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR: This node isn't allowed th
ere.
The code:
private boolean applyXSL2(String target, Document xslt) {
XmlDocument result = new XmlDocument();
try {
XSLTransformEngine te = new XSLTransformEngine();
Transform tr = te.createTransform(xslt);
tr.transform((Node)this.pdmExportDOM, result);
OutputStream out = new FileOutputStream(target);
result.write(out);
out.close();
} catch (Exception e) {
System.out.println("Error transforming dom");
e.printStackTrace();
//System.exit(-1);
return false;
return true;
When I try to do the transformation using Xalan (using DomResult), it works fine (except extremely slow, and I mean EXTREMELY slow).
I don't know where to look, because I know the XSL is fine, the input DOM is fine and the error doesn't say anything anything else than the error above...
Does anyone have an idea?
Thanks in advanceXSLProcessor transformer = new XSLProcessorImpl();
transformer.setParser(new CommentDriver());
transformer.loadStylesheet(new InputSource(xsl)));
OutputMethodHandlerImpl outMHI = new OutputMethodHandlerImpl(transformer);
transformer.setOutputMethodHandler(outMHI);
outMHI.setDestination(new OutputStreamDestination(result));
transformer.parse(new InputSource(xml)); -
hi
I have a curve 9300 using os 6 and the latest app world 2.1.1.. something
when i try to download apps it initiates the download then after a couple of seconds after starting it shows the error message "there was a problem during installation. Please try again"
i have tried ALL the suppourt forums (KB26671 and KB30074) and suggestions/threads and called my network but none have worked.
these were reinstallign app world, making a new blackberry id as the other email address was associated with an old blackberry, security wiping the phone then restoring it and entering the new bb id, changing the date to 2014 and then hard wiping the phone and restoring it
i have twitter, facebook and bbm ect apps but these are RIM made i think and already preinstalled. everything else on the phone works fine
i have tried both wifi and network internet and battery pull
i really dont know what else to try or who else to contact to fix it. very annoying paying for a service you cant even use!
any help or more ideas would be great!
thanksHello carckberrypie,
In this case i would recommend wiping the BlackBerry smartphone. To do this we would need to back up the BlackBerry smartphone http://bit.ly/aSediX
Once backed up please follow the link below to perform a security wipe of your BlackBerry smartphone.
Link: http://www.blackberry.com/btsc/KB14058
Test the BlackBerry smartphone and proceed with a selective restore as outlined below.
Link: http://www.blackberry.com/btsc/KB10339
Thank you
-DrP
Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
Be sure to click Kudos! for those who have helped you.
Click Solution? for posts that have solved your issue(s)! -
We encountered a problem during use the Configtool access JAVA engine.
We encountered a problem during use the Configtool access JAVA engine.
Our environment of system as below:
HardWard: IBM i570
OS: IBM as/400 V5E3
DB: DB2/400
Application system:SAP XI 3.0
The problem we encountered as below:
Our company used XI 3.0 SR1 for exchange data between SAP R/3 and no-sap system.For now,we wanna create a backup system(for
offline recovery),so we backup the XI product system throught entiry system save in AS/400(we stopped the XI system before
save process start).And following,we restored from the tape that we save from XI product system to the new backup system(they
are whole different paratition),but the problem is coming.Describe as following item:
1. The application seem to can be started but the java node always restart circularly(We have 4 java node now),I think
because of different of hardware configure(between XI product and Backup system) and lack of hardware resource.(XI prduction
have 5 CPUs and 22G Mem,Backup system have 2 CPUs and 16G MEM ).Therefore we wanna decrease the number of java nodes for
start application in backup system(throught configtool).
2. We wanna use configtool to decrease the java nodes for start backup system.But we encountered a problem during running the
configtool ,the information of prompt dialog as following:
Error occurred while working with Configuration (Scanning).
Msg:Error while connecting to DB.
We also see the system.log that below the directory of usr\sap\PXI\DVEBMGS00\j2ee\configtool,and found some error as
following text:
#1.5#C0000A0008A8000000000000017A906E000423BFFC7246E0#1165207387826#/System/Configuration/Logging##com.sap.tc.logging.APILogg
er.LogController[addLog()]#######Thread[main,5,main]##0#0#Info##Java#TC_LOGGING_CONFIGURATION_NEW_ITEMS
[C0000A305666000000000002018FB1F70003D67C779ECE88]##The () has been added to the !#3#Log#.
system.log#/System#
#1.5#C0000A0008A8000000000001017A906E000423BFFC73A670#1165207388006#/System/Server##com.sap.engine.core.configuration#######T
hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
Z:
sapmnt
PXI
global
security
lib
tools
iaik_jce_export.jar#
#1.5#C0000A0008A8000000000002017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
Z:
sapmnt
PXI
global
security
lib
tools
iaik_jsse.jar#
#1.5#C0000A0008A8000000000003017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
Z:
sapmnt
PXI
global
security
lib
tools
iaik_smime.jar#
#1.5#C0000A0008A8000000000004017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
Z:
sapmnt
PXI
global
security
lib
tools
iaik_ssl.jar#
#1.5#C0000A0008A8000000000005017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
Z:
sapmnt
PXI
global
security
lib
tools
w3c_http.jar#
#1.5#C0000A0008A8000000000006017A906E000423BFFC9C25A0#1165207390660#/System/Configuration/Logging##com.sap.tc.logging.APILogg
er.LogController[setResourceBundleName(String resourceBundleName)]#######Thread[main,5,main]
##0#0#Info##Java#TC_LOGGING_CONFIGURATION_IS_CHANGED[C0000A305666000000000000018FB1F70003D67C779CD2B8]##The for the
has been changed from to )!#5#resource bundle
name#LogController#com.sap.security.core.server.secstorefs.SecStoreFS#<null>#com.sap.security.core.server.secstorefs.SecStore
FSResources#
#1.5#C0000A0008A8000000000007017A906E000423BFFC9C4CB0#1165207390670#/System/Configuration/Logging##com.sap.tc.logging.APILogg
er.LogController[setResourceBundleName(String resourceBundleName)]#######Thread[main,5,main]
##0#0#Info##Java#TC_LOGGING_CONFIGURATION_IS_CHANGED[C0000A305666000000000000018FB1F70003D67C779CD2B8]##The for the
has been changed from to )!#5#resource bundle
name#LogController#/System/Security/SecStoreFS#<null>#com.sap.security.core.server.secstorefs.SecStoreFSResources#
#1.5#C0000A0008A8000000000008017A906E000423BFFCAC7D38#1165207391731#/System/Server##com.sap.engine.core.configuration#######T
hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###OpenSQLDataSource successfully created with secure
store.#
#1.5#C0000A0008A8000000000009017A906E000423BFFCDA3070#1165207394726#/System/Configuration/Logging##com.sap.tc.logging.APILogg
er.LogController[setResourceBundleName(String resourceBundleName)]#######Thread[main,5,main]
##0#0#Info##Java#TC_LOGGING_CONFIGURATION_IS_CHANGED[C0000A305666000000000000018FB1F70003D67C779CD2B8]##The for the
has been changed from to )!#5#resource bundle
name#LogController#/System/Database/sql/jdbc#<null>#com.sap.sql.log.OpenSQLResourceBundle#
#1.5#C0000A0008A800000000000A017A906E000423BFFCDB41E0#1165207394796#/System/Database/sql/jdbc##com.sap.sql.jdbc.NativeConnect
ionFactory#######Thread[main,5,main]
##0#0#Error#1#com.sap.sql.jdbc.NativeConnectionFactory#Java#com.sap.sql_0002#com.sap.sql.log.OpenSQLResourceBundle#SQL error
occurred on connection : code={0,number,integer}, state="", message="".#5#-99999#08001#The application requester
cannot establish the connection. (XIPRD)#jdbc:as400://XIPRD/SAPPXIDB;transaction isolation=read uncommitted;data
truncation=true;date format=jis;time format=jis;sort=hex;hold input locators=true;hold statements=true;cursor
hold=false#<null>#
The "SQL error occurred on connection" happened during start run configtool.
We don't know how to solve this problem.
ThanksI am unable to start my configtool.bat to administer JVM memory settings for my J2EE.
Wait......
Thanks -
Problem in transforming xml to html using xsl
Hi everybody ,
I am creating a xml in memory and i want to transform using xsl into an html.
I want to embed some html code also in the data node.But when I get the html it simply writes as it is. I tried to make it cdata section but it did not worked. Pls help.
crypticashu
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class mytemp {
public static void main(String args[])
DocumentBuilder builder = null;
Document document = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try
builder = factory.newDocumentBuilder();
document = builder.newDocument();
catch (ParserConfigurationException e)
e.printStackTrace();
Element root = (Element) document.createElement("REPORT");
document.appendChild(root);
Node child = document.createElement("DATA");
CDATASection data = document.createCDATASection("<b>Hello World </b>");
child.appendChild(data);
root.appendChild(child);
document.getDocumentElement().normalize();
DOMSource domsource = new DOMSource(document);
TransformerFactory tfactory = TransformerFactory.newInstance();
File f = new File("c:/mytemp/report.xsl");
StreamSource xsl = new StreamSource(f);
File html = new File("c:/myhtml.html");
try
Templates templates = tfactory.newTemplates(xsl);
Transformer transformer = templates.newTransformer();
transformer.transform(domsource, new StreamResult(html));
catch(Exception e)
e.printStackTrace();
}want to embed some html code also in the data node.But when I get the html it simply writes as it is.That statement contradicts:
In real application i will be getting data containg html tags.I want the parser to read that data as simple text. Both cannot be true. You either want the HTML to not be parsed or you want the transformer to deal with it. Which one?
- Saish -
Java.lang.thread exception while using Xalan 2.0 in WLS 6.0
Hi, I'm trying to use Xalan 2.0 in a servlet hosted by WLS. Ive
modified Xalan's SimpleTransform sample to be a servlet. I
create a Transformer with the .xsl, then call tranform() to
print the tranformed xml to the response stream. The xml is
tranformed correctly, but it throws a java.lang.thread
exception. The standalone Xalan sample doesn't do this. Anyone
else seen this problem?
Here's the code of interestest, I apologize if its not formatted very well:
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException
PrintWriter out = res.getWriter();
res.setContentType("text/html");
out.println("<html><head><title>XalanTest<title></head>");
out.println("<body><h1>XalanTest</h1>");
try{
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamSource ss = new StreamSource("file:\\\\My-path\\birds.xsl");
Transformer transformer = tFactory.newTransformer(ss);
StreamResult SR = new StreamResult(out);
transformer.transform(new StreamSource("file:\\\\My-path\\birds.xml"), SR );
catch(Exception e){
out.println("<p>" + e.toString() + "</p>");
e.printStackTrace(out);
out.println("<p>Exception</p>");
out.println("</body></html>");It also looks like the workaround suggested does not work.
I put the following code as workaround:
response.setContentType("text/html");
response.setHeader ("Pragma", "no-cache");
Transformer transformer;
TransformerFactory factory = TransformerFactory.newInstance();
String stylesheet = "config\\closs\\applications\\webroot\\jsp\\example\\Load2.xsl";
String sourceId = "config\\closs\\applications\\webroot\\jsp\\example\\Load2.xml";
String outputFile = "config\\closs\\applications\\webroot\\jsp\\example\\Load2.html";
String outputDirectFile = "config\\closs\\applications\\webroot\\jsp\\example\\Load2_Direct.html";
try
PrintWriter fout = new PrintWriter (new FileOutputStream (outputFile));
OutputStream os = new ByteArrayOutputStream();
transformer = factory.newTransformer(new StreamSource(stylesheet));
transformer.transform(new StreamSource(sourceId), new StreamResult(outputDirectFile));
transformer.transform(new StreamSource(sourceId), new StreamResult(os));
os.flush ();
os.close();
out.print(os.toString());
fout.print (os.toString ());
fout.flush ();
fout.close ();
catch (Exception e)
// Error Handler
e.printStackTrace();
The two .html files produced look exactly the same, which is good.
However, the screen output to my html browser (Internet Explorer 5.50 sp1) produces
different output.
That is strange, but that shows that this bug does not have a known workaround
"Rabinowitz" <[email protected]> wrote:
>
I have the same problem with java sun xml parser (jaxp 1-1)
It is interesting to know that all this perfectly works under weblogic
5.1, so
I cannot migrate my application to 6.0
So, the functionality of weblogic 6.0 degraded since 5.1.
I cannot buy the explanation that that is not bea's fault, because it
perfectly
worked with the same version of xml parser.
Now, their customer support is saying they have not decided whether this
is a
bug or a feature.
Interesting to know that degradation of functionality could be a feature!
It is now June 21, 3 months since this bug was reported, sp2 was shipped
since
that time, and this bug is still there.
"Chuck H. Zhao" <[email protected]> wrote:
I am having the exact same problem you are having. If we analyze the
stack
trace:
javax.xml.transform.TransformerException: java.lang.Thread
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1212)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
java.lang.ClassCastException: java.lang.Thread
at
weblogic.servlet.internal.ResponseHeaders.setDateHeader(ResponseHeaders.java
:273)
at
weblogic.servlet.internal.ServletResponseImpl.setDateHeader(ServletResponseI
mpl.java:449)
at
weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseIm
pl.java:637)
at
weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamI
mpl.java:124)
at
weblogic.servlet.internal.WLOutputStreamWriter.flush(WLOutputStreamWriter.ja
va:124)
at java.io.PrintWriter.flush(PrintWriter.java:120)
at
org.apache.xalan.serialize.SerializerToXML.flushWriter(SerializerToXML.java:
1431)
at
org.apache.xalan.serialize.SerializerToXML.endDocument(SerializerToXML.java:
629)
at
org.apache.xalan.transformer.ResultTreeHandler.endDocument(ResultTreeHandler
..java:180)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1194)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
What happened is: to support incremental output, Xalan-Java performs
the
transformation in a second thread while building the source tree inthe
main
thread. So Transformer.transform() creates a new thread to run the
transformer.run() method, which will write to weblogic's internal
ServletOutputStreamImpl, and in the end calls flush() on it.
ServletOutputStreamImpl determines that the headers haven't been written
yet, and the headers need to be written before any servlet output, so
it
calls ServletResponseImpl.writeHeaders(), which eventually calls
ResponseHeaders.setDateHeader(). The last method assumes the thread
is
weblogic's internal ExecuteThread and tries to cast the thread as such,
maybe to get the date from it. But the thread is a plain java.lang.Thread
created by xalan, thus we get the java.lang.ClassCastException:
java.lang.Thread
This suggests a second workaround: call ServletResponse.flushBuffer()
before any xalan stuff, which will force the headers to be written in
weblogic's ExecuteThread. The shortcoming of this is that this will
cause
the response to be commited, and if the xalan stuff throws exception
you can
not forward to another page.
Another thing is that xalan should not directly call flush() on
ServletOutputStreamImpl at all. I will report it to xalan and see if
they
consider that a bug. If they fix that then we have a third workaround:
set
the buffer size of ServletResponse big enough to accomodate everything
including the xslt outputs, so the ServletOutput does not need to be
flushed
during xalan code.
I do not consider this problem a weblogic bug, since the servlet container
has to right to expect any thread inside it to be its own. Serlvet2.2
spec
says:
1.2 What is a Servlet Container?
A Servlet Container may place security restrictions on the environment
that
a servlet executes in. In
a Java 2 Platform Standard Edition 1.2 (J2SE) or Java 2 Platform Enterprise
Edition 1.2 (J2EE)
environment, these restrictions should be placed using the permission
architecture defined by Java 2
Platform. For example, high end application servers may limit certain
action, such as the creation of
a Thread object, to insure that other components of the container are
not
negatively impacted.
Weblogic should explicitly warn the developers that creating threads
inside
the servlet container may have adverse effects, the same kind of problem
we
are having. (or maybe they already did somewhere in their documentation?)
On the xalan side, I would suggest them to either give the option to
switch
the two threads, or to give the option to buffer the output and write
it out
in the main thread, which is exactly what you did in your first workaround.
Any comments or thoughts on the subject are welcome.
-- Chuck Zhao
"MK Parini" <[email protected]> wrote in message
news:[email protected]...
I found, what I think to be a bug, and a work-around for it.
When doing an XSLT Transformation, you must specify a StreamResult
to which to write the output. I was doing my transformation in
a
servlet so I was writing my output to the HttpResponse
(The variable res is a javax.servlet.http.HttpServletResponse
object)
StreamResult htmlTarget = new StreamResult(res.getWriter());
If I use this, when I perform the transformation using the TRAX
APIs,
InputStream xslFile = context.getResourceAsStream(fileName);
TransformerFactory tFactory = TransformerFactory.newInstance();
Templates xslTemplates = tFactory.newTemplates(new StreamSource(xslFile));
transformer = xslTemplates.newTransformer();
transformer.transform(xmlSource, htmlTarget);
I receive the ClassCastException from the class
weblogic.servlet.internal.ResponseHeaders.setDateHeader(ResponseHeaders.java
:273),
as seen in my previous posting.
I discovered, if I write my output to a StringBuffer, and then
I write
the StringBuffer to the HttpResponse, I do not get the ClassCastException.
For example,
StringWriter myWriter = new StringWriter(2400);
StreamResult htmlTarget = new StreamResult(myWriter);
<Same transformation code as above>
myWriter.close();
PrintWriter out = res.getWriter();
out.print(myWriter.toString());
Is this a bug in the weblogic internal servlet class or am I just
missing something?
Also, one concern that I have with the workaround is that it might
hurt performance.
Any comments or thoughts on the subject are welcome. -
Java object XSLT parameters problem. JDK vs Xalan.
Hello all,
I need to create a small application which requires to run some transformation interacting with a number of Java classes.
Small example is below: I have a Java class, which I'm going to use within transformation.
package com.example;
public class Document
private String filename=null;
public String getFilename() {
return this.filename;
}and transformation which extracts some information from the passed parameter object
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:document="com.example.Document">
<xsl:param name="theDocument"/>
<xsl:template match="/">
<example>
<xsl:value-of select="document:getFilename($theDocument)"/>
</example>
</xsl:template>
</xsl:stylesheet>The code which launches transformation is following:
try {
TransformerFactory factory = TransformerFactory.newInstance();
Templates template = factory.newTemplates(new StreamSource(new FileInputStream(transformationFilename)));
Source source = new StreamSource(new FileInputStream(theSourceFilename));
Result result = new StreamResult(new FileOutputStream(theTargetFilename));
Transformer transformer = template.newTransformer();
transformer.setParameter("theDocument", theDocument);
transformer.transform(source, result);
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}When I run it I get
ERROR: 'Cannot find external method 'com.example.Document.getFilename' (must be public).'
FATAL ERROR: 'Could not compile stylesheet'at this line
Templates template = factory.newTemplates(new StreamSource(new FileInputStream(transformationFilename)));I made a test with a variable, when Document instance is not a parameter but an instance created within transformation and assigned to an XSLT variable. Everything works fine in variable case, but not with parameter.
Once I've added Xalan-2.7.1 .jars to the classpath it had been fixed. I guess the issue is described here (yep, I'm using 1.5).
XSLTC does not support all the extensions that Xalan does. These extensions are beyond the definition of the JAXP and XSLT specifications. For those users impacted by this, the work around of downloading the Xalan classes from Apache is still available. Also, going forward we expect to be supporting more and more extensions in XSLTC.
However, I'd like to find Xalan free solution. Could someone explain what is the difference and how implement the same behaviour without using Xalan?
Thank you in advance.georgemc, your answer may not have helped the original poster, but it just helped me out. So, thank you very much.
To clarify, for the benefit of anyone else who encounters this issue, it looks as if a possible cause of the 'Cannot find external method' error is that the transformer is defaulting to something - possibly XSLTC - that does not support certain extension methods. Ensuring that a recent Xalan JAR is in the classpath may resolve the problem.
Edited by: slamci on Mar 13, 2010 11:14 AM -
Header problem during convert Word to PDF through FOP
Hi, below are the senarios that I face the problem,
1. I have converted a combination of XML file (contains data only) and XSL file ( containts template only ) into Microsoft Word file. This is done by using xalan as the transformer library.
2. This converted Microsoft Word file will be converted into XSL-FO format.
3. By applying FOP(Implementation-Version: 0.20.5) library, the converted Microsoft Word file ( in XSL-FO format ) has been converted into PDF file successfully.
4. The problem is, althought there is file header at the Microsoft Word document, but the converted PDF file's file header is missing.
May I know how to solve the problem?What version of Word are you running? If you open Word, do you see the Acrobat PDFMaker Add-on Ribbon? Here is what it looks like in Office 2010. If you have this try creating the PDF from the Acrobat ribbon.
-
We have a document-level customization solution for Word and are experiencing problems during deployment in an environment running on terminal services. The OS (Windows 2012) is English and Word (2013) is non-English (German).
Installation is done into the "Program Files" folder correctly. But when trying to start a word document linked to the specific template. The "Microsoft Office Customization Installer" pops up with the error.
"There was an error during installation"
From: file:///C:/Programme/[CompanyName]/[Productname]/[Productname].vsto
Downloading file:///c:/Programme/[CompanyName]/[Productname]/[Productname].vsto did not succeed.
Exception: ....
System.Deployment.Application.DeploymentDonwloadException: Download file:///C:/Programme/[Companyname]/Productname]/[Productname].vsto did not suceed. ---> System.Net.WebException: Could not find a part of the path 'C:\Programme\[Companyname]\[Productname]\[Productname].vsto'.
---> System.Net.WebException: ...... ---> System.IO.DirectoyNotFoundException......
The problem seems to be that the installer is looking for C:\PROGRAMME instead of C:\PROGRAM FILES. C:\PROGAMME is the German localized name of PROGRAM FILES (http://en.wikipedia.org/wiki/Program_Files).
The installer installs the solution correctly deployed into c:\program files, but when the later a user tries to start it and the Microsoft Office Customization Installer is called, it tries to access the non-existing "c:\programme" folder. This
doesn't exist, because Windows is English.
Is there any thing related to deploying solutions on a platform which has different languages (mixing/matching of OS language and Office language?)
Thank you for your helpHello,
1. First, I would confirm with you whether you dealt with the localization for your document-level add-in?
2. Did you use this way to define the Create a class that defines the post-deployment action part of Put the document of a solution
onto the end user's computer (document-level customizations only) and did you get the path with Environment.SpecialFolder enum?
To handle this, I would recommend you consider using Environment.SpecialFolder to set that property.
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
I just added songs to my library but when I connected my iPhone 4 to my macbook pro, iTunes wouldnt let me take those songs and put them on my phone. I've clicked the sync button but it seems to say that it'll delete all my existing songs on my phone
-
HP 2500n Toolbox Will not run on Windows 7
Hi, I am having problems. The original install cd does not give you the HP 2500n toolbox under Window 7. How do I find out how much toner there is left in each of the colour cartridges. The toolbox would give you detailed info on there status using
-
I really need help with this please!
-
Applying a filter to an existing webi report without requerying
Hi, I'm trying to apply a filter to a webi report using the Report Engine Java SDK. Here's a snippet of my code: DataProviders dataProviders = doc.getDataProviders(); DataProvider dataProvider = dataProviders.getItem(0); Query queryObj =
-
[yet another] problem with proxy
On my PC, sometimes I am connected directly to the Internet and sometimes via VPN. In the latter case, all Internet traffic goes via http/https/socks proxy. In either of these situations Skype works well, but... The is a problem when I disconnect fro