URL in XSLT
hi...
I am facing a problem in giving URL of xsl in XSLT.
Can anybody suggest me?
my XSL resides in repository/Process Management/demo_forms
Please help me out.
Thanks and Regards
Ambika
I believe the URL in the "Transform Using XSLT (URL)" operation is for a web URL and not a url to the repository.
If it's stored in the repository, you could use a ReadRessource (from Repository category) and put it in a document variable and pass that as the source for the "Transform" operation.
Jasmin
Similar Messages
-
XML to URL Encoded (XSLT?)
I have some data in a Document object and need to convert it to URL encoded format so, for example this:
<share>
<code>GSK</code>
<price>13.34</price>
</share>
becomes something like...
&code=GSK&price=13.34& ...
I've been looking into doing this with XSLT but have run into difficulties. Do you think this is the best way of solving this problem, or is there another easier way?
Thanks.I did something similar, basically takes a incoming XML file and output a HTML with certain link containing XML element value as query string. One of the things you have to be careful is, like Dr. Clap mentioned, to properly encode the value. I accompolished by using java extension in my XSL.
For example:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:encode="java.net.URLEncoder"
extension-element-prefixes="encode"
version="1.0">
<xsl:template match="/">
<xsl:variable name="myURL" select="concat('?blah=', encode:encode($myValueFromXML))" >
</xls:template>
</xsl:stylesheet> -
XSLT, LIBXSLT, and func:script
My understanding is libxslt supports calling javascript from inside XSLT using the extension func:script.
Does any version of Sarfari support this feature of libxslt?
I am attempting to get the browser url inside XSLT as part of the transformation of XML to XHTML using XSLT on the browser.
IE, Forefox, and Opera provide support for either allowing the use of Javascript from inside XSLT or the ability to use Javascript to call a parameterized XSLT style sheet.
I am looking for a way in Safari of supporting the use of the browser URL to conditionally control what is XHTML is shown to the user so I am hoping Safari supports func:script inside libxslt since I know that Safari does not support calling XSLT from javascript.
John PerkinsWhen using the Custom XSLT option, you have to maintain the Extension Xml yourself, just as you would for inline custom Xslt that calls external Assemblies.
Docs:
http://msdn.microsoft.com/en-us/library/aa547368.aspx
Sample:
http://blog.vertica.dk/2013/03/20/using-custom-xslt-in-biztalk/ -
How to get the description value of the hyperlink field in the link list for xslt list view webpart ? i.e how do I get the value of description in the XSLT that I provide for XslLink?
Hi,
If there is a hyperlink field in your list view, then there would be a variable “$desc” in the xslt code, you can call it like this:
<xsl:value-of select="$desc"/>
Here are two links with code samples about how to customize the the rendering of a hyperlink field for your reference:
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/68b05f40-9b62-485b-ba8e-4684a7e34899/truncate-url-in-xslt-view
http://sharepoint.stackexchange.com/questions/58672/painless-way-to-display-hyperlink-as-url
More information about XSLT language:
http://www.w3schools.com/xsl/
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support -
Hi. This is what I Have...
D:\testing\stocks.xml - well formed XML file
D:\testing\stocks.xslt - displays the above XML file in a table
D:\testing\view.jsp
This is the code for view.jsp<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<html>
<head>
<title>JSP, XML and XSLT</title>
</head>
<body bgcolor="#FFFFCC">
<h3>Transforming XML into HTML using XSLT</h3>
<c:import url="stocks.xml" var="xmldocument"/>
<c:import url="stocks.xslt" var="xslt"/>
<p>Imported...</p>
<c:out value="${xmldocument}"/>
<c:out value="${xslt}"/>
<p>Transformation...</p>
<x:transform xml="${xmldocument}" xslt="${xslt}"/>
</body>
</html>And this is what I get when I drag view.jsp into my browser window...
Transforming XML into HTML using XSLT
Imported...
Transformation...
I used Altnova XMLSpy and StyleVision to generate the XML and XSLT files, and I know the stylesheet correctly displays a table containing the contents of the XML file.
So why doesn't the JSP import teh XSLT and XML and initiate the transformation?Sorted it, just put the jsp into an existing web app and linked to it from the controller servlet.
-
Problem Tranforming xml using jstl
Hello To Every One
I have transformed xml document using servlet now i need to know how can i transform xml document using jstl. I have found this code very often but it doesn't work with a relative or absolute url. I need to pass parameters dynamically.
<c:import var="xml" url="<%=xmlFile%>" />
<c:import var="xslt" url="<%=xsltFile%>" />
<x:transform xml="${xml}" xslt="${xslt}" />In this code I have to pass xmlFile and xsltFile parameter dynamically and i want to make it as session variables. When i put relative url in *<c: import >* tag it works fine but for absolute url it does not work. Although I doesnot want to pass absolute url but relative ones, but how can i achieve that one.
E.G.
<x:transform xml="relative url for xmlfile" xslt="relative url for xslt file" />If anyone have the solution please reply me as soon as possible. Thanx in Advance for your kind Attention.Thanx for your answer This is my Code which works fine.
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
<html>
<head>
</head>
<body>
<form method="post">
<c:import var="xml" url="..\\data\\192.168.1.94\\master.xml" />
<c:import var="xslt" url="..\\other\\Masterview.xsl" />
<x:transform xml="${xml}" xslt="${xslt}" />
</form>
</body>
</html>But in <c:import > tag i want to put url value dynamically so when i convert that string to a variable and pass that variable into url attribute it does not work.
Like This
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
<html>
<head>
</head>
<body>
<%
try{
String xmlFile="..\\data\\"+session.getAttribute("param1").toString()+"\\master.xml";
String xsltFile="..\\other\\"+session.getAttribute("param2").toString()+"\\MasterView.xsl";
}catch(Exception ep){ep.printStackTrace();}
%>
<form method="post">
<c:import var="xml" url="<%=xmlFile.toString()%>" />
<c:import var="xslt" url="<%=xsltFile.toString()%>" />
<x:transform xml="${xml}" xslt="${xslt}" />
</form>
</body>
</html> -
XSLT Issue to open URL in new tab and PopUp Window through one custom style
I have SharePoint Online Custom List that contains two columns
Name: Single Line of Text
URL: Hyperlink or pictures
Using XSLT I have shown Name columns value on my home page by using below custom style in
Itemstyle.xsl file.
Custom style to show Link in PopUp window itemstyle.xsl
<xsl:template name="OpenApplicationPagePopUp" match="Row[@Style='OpenApplicationPagePopUp']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="@Title"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<div class="item link-item">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<a href="{$SafeLinkUrl}" onclick="ShowPopupDialog(GetGotoLinkUrl(this));return false;">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$DisplayTitle"/>
</a>
</div>
</xsl:template>
My Requirement to show only Suggestion Box in Popup window Other Links Should be open in new Tab So please suggest me what can change in above xslt...
Thanks
Deepak Chauhan
SharePoint 2010 & 2013 and Office-365 Branding and Front End Customization, UI DesignHi,
In SharePoint 2013, we can use JSLink to achieve it.
1. Save the following code as a js file (URLPopup.js) and upload it into the
SiteAssets Document Library.
// List View – Field open modal dialog Sample
(function () {
// Create object that have the context information about the field that we want to change it output render
var linkFiledContext = {};
linkFiledContext.Templates = {};
linkFiledContext.Templates.Fields = {
//Apply the new rendering for URL field on List View
// "URL" is the column name.
"URL": { "View": URLFiledTemplate }
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(linkFiledContext);
// This function provides the rendering logic for list view
function URLFiledTemplate(ctx) {
var itemTitle=ctx.CurrentItem.Title;
var urlLink=ctx.CurrentItem.URL;
var urlDesc=ctx.CurrentItem['URL.desc'];
if(urlLink!=null&&urlLink!=""){
if(itemTitle=="Suggestion Box"){
return "<a href='#' onclick=\"openModalDialog('"+urlLink+"')\">"+urlDesc+"</a>";
}else{
return "<a href='"+urlLink+"' target='_blank'>"+urlDesc+"</a>";
}else{
return "";
function openModalDialog(url)
var options = {
title: "Suggestion Box",
autoSize: true,
url: url
SP.UI.ModalDialog.showModalDialog(options);
return false;
2.Edit the list view page.
3.Edit the list web part. Go to Miscellaneous -> JS Link.
4.Add the following URL into the JS Link textbox.
~site/SiteAssets/URLPopup.js
5.Click "OK" and save the page.
Best Regards
Dennis Guo
TechNet Community Support -
Resolving url after document() function has been called by the xslt
I am having problems resolving a URI when document() function in my xslt is called. The xml document that is being called has a reference to a dtd that is in another location of the webserver. When document() is called it downloads the xml document then tries to download the referenced dtd from the same location. I get an error kinda like this.
file:///C:/dev.xsl; Line 15; Column 62; Can not load requested doc: File "http://dev.server.com/templatedata/lhj/story/data/dcr4.5.dtd" not found.
The DTD is in a different location on the server and that is why it can not find it. I have tried resolving the URL but have been unsucessfull. See my java solution that does not work. How can I fix this? Any assistance will be greatly appreciated
Java solution
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
tFactory.setURIResolver(new XMLURIResolver());
Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
File f = new File(xmlFile);
FileReader fr = new FileReader(f);
InputSource inputSource = new InputSource(fr);
transformer.transform(new SAXSource(inputSource),
new StreamResult(new FileOutputStream(outPutPath)));
Vince.here is the resolver. The if in never excuted.
public class XMLURIResolver implements URIResolver{
public static final String DTD_HREF = "dcr4.5.dtd";
public Source resolve(String s, String s1) throws TransformerException{
System.out.println("s = "+ s);
System.out.println("s1 = " + s1);
InputStreamReader isr = null;
try{
if (s.indexOf(DTD_HREF) != -1){
System.out.println("Fetching DTD....");
URL url = new URL("http://mydomain/xml/validation/dcr4.5.dtd");
isr= new InputStreamReader(url.openStream());
return new SAXSource(new InputSource(isr));
}catch(MalformedURLException mue){
System.out.println(mue);
}catch(IOException ioe){
System.out.println(ioe);
return null;
} -
We support a site that generates pages based on XML and XSLT where XSLT uses unparsed-entity-url() but it dont seem to work in Firefox.
By posting on the forum you are asking the wrong people. We are Apple users, not employees. If you want to provide this feedback directly to Apple you should leave the feedback at:
http://www.apple.com/feedback/iphone.html -
Cannot create mysites from powershell: Original XSLT List View Web Part not found
I have a bizarre problem in my SharePoint 2013 farm. This does not occur in my test farm, only in the farm we were going to go live with.
I'm on windows Server 2012, SQLServer 2012 SP1, SharePoint 2013 April CU. 1 appserver/centraladmin server, 2 web servers.
When I log into our mysitehost and click newsfeed, it will create a mysite (even though first it displays "we are sorry there was a problem creating your site")
But from powershell, whether I use $UserProfile.CreatePersonalSite() or New-SPSite, I get the following error:
Original XSLT List View Web Part not found
So far I've only found one other person with this:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2503e42c-e114-4e89-8e00-89fe70f0b154/cannot-create-sharepoint-mysite-programmatically
This is a brand new farm, created with the same scripts I created my test farm with, and same version of SharePoint. Only the service accounts are different. (Farm account has admin on the servers right now since I was setting up profile service).
Some other errors from the same correlation ID that look related:
It can't seem to find the listemplate 101
And something looks wrong with the MySiteDocumentLibrary feature
I have tried the following:
1. run psconfig.exe on each server
2. install-spfeature -AllExistingFeatures
3. looped through the directory under Features and for each called Install-SPFeature $dirname -Force
4. uninstalled and reinstalled MySiteDocumentLibrary feature
5. blew away the whole farm (removed all servers from farm, deleted all databases) and recreated it.
6. tried creating the UPA from the CentralAdmin gui.
The only real difference I can think of between the working farm and non working farm is, I installed the working farm using RTM, then as they came out added the March PU and April CU. For this farm I installed RTM and March and April, and then ran my build
farm script.
I am at a loss. What do I need to do, re-install the binaries? That's all I can think of. What I love is that our test / POC system worked fine, and now 2 weeks before go-live I'm seeing errors on the production servers I've never seen before. Using the
same scripts no less.
Feature Activation: Feature 'Fields' (ID: 'ca7bd552-10b1-4563-85b9-5ed1d39c962a') was activated
Feature Activation: Feature 'CTypes' (ID: '695b6570-a48b-4a8e-8ea5-26ea7fc1d162') was activated
No document templates uploaded for list "$Resources:core,global_onet_solutiongallery_list;" -- none found for list template "100"
Failed to find <ListTemplate> tag corresponding to ID "101", tried both onet.xml for site definition ID "0" language "1033" and global site definition. Operation failed.
No document templates uploaded for list "$Resources:core,stylelibraryList;" -- none found for list template "121".
System.Runtime.InteropServices.COMException: A user may not remove his or her own account from a site collection.<nativehr>0x81020051</nativehr><nativestack></nativestack>, StackTrace: at Microsoft.SharePoint.SPUserCollection.UpdateMembers
Feature Activation: Feature 'MySitePersonalSite' (ID: 'f661430e-c155-438e-a7c6-c68648f1b119') was activated
Feature Activation: Activating Feature 'MySiteDocumentLibrary'
Calling 'FeatureActivated' method of SPFeatureReceiver for Feature 'MySiteDocumentLibrary'
SharePoint Foundation Upgrade MySiteDocumentLibraryFeatureReceiveraj08n INFO Creating new My Documents library
Unknown SPRequest error occurred. More information: 0x80070002
SPRequest.GetMetadataForUrl: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://contoso/personal/cbuchholz/DOCUMENTS ,METADATAFLAGS=59
System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>, StackTrace: at Microsoft.SharePoint.SPWeb.GetObjectForUrl at Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryUtil.GetSPObjectFromUrl ...
<nativehr>0x80070002</nativehr><nativestack></nativestack>There is no Web named "/personal/cbuchholz/DOCUMENTS"
Possible mismatch between the reported error with code = 0x81070504 and message: "There is no Web named "/personal/cbuchholz/DOCUMENTS"." and the returned error with code 0x80070002.
Attemping to add webpart id 0F6072F2-E804-4CFD-837E-BB37332B9D1C to web http://contoso/personal/cbuchholz
Adding XsltListViewWebPart calling SPRequest::CreateListViewPart. Web part id 0F6072F2-E804-4CFD-837E-BB37332B9D1C, web http://contoso/personal/cbuchholz
Feature receiver assembly 'Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c', class 'Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryFeatureReceiver', method 'FeatureActivated' for feature 'e9c0ff81-d821-4771-8b4c-246aa7e5e9eb' threw an exception: System.InvalidOperationException: Original XSLT List View Web Part not found at Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentLibraryUtil.ReplaceListViewWebPart
Feature Activation: Threw an exception, attempting to roll back. Feature 'MySiteDocumentLibrary'
Exception in EnsureFeaturesActivatedAtSite: System.InvalidOperationException: Original XSLT List View Web Part not found
Failed to activate site-collection-scoped features for template 'SPSPERS#2' in site collection 'http://contoso/personal/cbuchholz'
Failed to apply template "SPSPERS#2" to web at URL "http://contoso/personal/cbuchholz
I've had other problems in this farm: the bug where when you add Administrators to a Search Service via the Manage Service Applications page, it removes the SPSearchDBAdmin role from the search service process account. That one did not happen in the other farm.
At least other people have that one and I could just use the farm admin instead (still troublng of course).Ok,
Here is the problem:
When creating a mysite from powershell or script, apparently you can ONLY do this from a wfe (or a server running Microsoft SharePoint Foundation Web Application in services on server).
You CANNOT create mysites from script on your appserver if it is not also a Web Application Server. I confirmed the same is true in my test farm. I guess I was always running most of these scripts on the webserver.
I searched all over and cannot find this documented anywhere.
Who do I contact to have Microsoft document this?
It's Thursday morning, I've been working non stop since Saturday morning so you don't have to :) -
Hi-
I'm trying to use the latest Xercies/Xalan classes in OC4J 10.1.3 as described in the How-To swap XML Parsers document:
http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html
What I can see happening is that the oracle.xml shared library is successfully 'turned off', but the xalan libraries are not added. Instead, the default xml classes that are distributed with the JDK become visible. For instance, using a slightly modified version of the index.jsp page from the how-to, I get this result:
------ Output from JSP page ----------------
TransformerFactory Instance: org.apache.xalan.processor.TransformerFactoryImpl
Transformer Instance: org.apache.xalan.transformer.TransformerIdentityImpl
Transformer Version: Xalan Java 2.4.1 (!!)
What I expect is for that last line to say version 2.7.0, which is the version of the xalan.jar included in my shared library (code to add that line to the how-to shown below).
I suspect what is happening is that the class loader is simply not letting a shared library override a system library - to do that you probably need to place the jar files in system endorsed directory.
Has anyone gotten this how-to to work - actually replacing the XML parser/transform classes with the latest Xalan classes? Are you sure it is seeing the current version you placed in the shared library?
Thanks,
Eric Everman
---- My modified getXSLTDetails() method in the index.jsp page of the how-to -------
<!-- Additional Import -->
<%@ page import="org.apache.xalan.Version" %>
public static String getXSLTDetails()
Transformer transformer=null;
TransformerFactory transformerfactory = TransformerFactory.newInstance();
Version ver = null;
String br = "<" + "br" + ">"; //otherwise the otn forum chocks on the break.
try
transformer = transformerfactory.newTransformer();
ver = (Version) transformer.getClass().forName("org.apache.xalan.Version").newInstance();
String ret_val =
"TransformerFactory Instance: "+transformerfactory.getClass().getName() + br +
"Transformer Instance: "+transformer.getClass().getName() + br;
if (ver != null) {
ret_val = ret_val + "Transformer Version: " + ver.getVersion() + br;
} else {
ret_val = ret_val + "Transformer Version not Available" + br;
return ret_val;
catch (Exception e)
e.printStackTrace();
return e.getMessage();
}--------------------------------------------------------------------Steve - Thanks for responding on this.
The Xalan SQL extension is built into Xalan. The most painless way to try it out is to run it via JEdit: www.jedit.org
JEdit a OS Java application with a fairly painless install process (I'm assuming you already have a current JRE installed). Once its installed, you'll need to install the XSLT plugin - in JEdit goto Plugins | Plugin Manager | Install and pick the XSLT plugin. You'll need the Oracle JDBC classes on your classpath - this can be done by copying the oracle_jdbc4.jar into the [JEdit install directory]/jars directory.
Restart to load that jar and you should be all set.
I included a sample XSLT page at the bottom of this post that is somewhat of a template transform for the SQL extension - its more complicated then it needs to be, but it does some nice things with the results of the query. Save it as a file and make the appropriate changes to the 'datasource' parameter near the top of the file.
Then in JEdit, open the file and make sure the XSLT plugin is visible (Plugins | XSLT | XSLT Processor Toggle - or alternately dock it in the window via global prefs). In the XSLT plugin: Allow the current buffer to be used as the source, Add that same file as a stylesheet via the '+' button, and pick a result file at the bottom. Then click the 'Transform XML' button.
Troubleshooting: I seem to remember having some classpath errors when I tried this on windows, but others have had it work w/o issues. I do remeber that the XSLT plugin had a popup window that gave a pretty good explaintion of the problem, if it occurs. Also, for some reason the XSLT plugin will not create a new file for the output, so its often best to create a file first, then choose it as the output. Of course, you can always run a transformation from the command line or w/in an applicatoin. Full docs on the Xalan SQL extension can be found at: http://xml.apache.org/xalan-j/extensionslib.html#sql
Here is my sample XSLT transform using the SQL extension:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://xml.apache.org/xalan/sql"
xmlns:str="http://exslt.org/strings"
xmlns:xalan="http://xml.apache.org/xalan"
extension-element-prefixes="sql str xalan">
<xsl:output indent="yes"/>
<xsl:param name="driver">oracle.jdbc.OracleDriver</xsl:param>
<xsl:param name="datasource">jdbc:oracle:thin:jqpublic/jqpublic@server_name:1521:dbname</xsl:param>
<xsl:param name="jndiDatasource"><!-- jndi source for production use w/in enterprise environment --></xsl:param>
<xsl:param name="debug">true</xsl:param>
<xsl:variable name="connection" select="sql:new()"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
<!--
The query: You could pass parameters in to this query to build a where clause, but here is a simple example.
Also, its nice to wrap the query with a max row number to prevent huge results.
-->
<xsl:param name="query">
select * from (
SELECT
'One' FIELD_1,
'Two' FIELD_2
FROM DUAL
) where rownum < 100
</xsl:param>
<!-- Essentially, create a XConnection object -->
<xsl:variable name="connection" select="sql:new()"/>
<xsl:template match="/">
<xsl:choose><!-- Connect using JNDI -->
<xsl:when test="$jndiDatasource != ''">
<xsl:if test="not(sql:connect($connection, $jndiDatasource))">
<xsl:message>Failed to connect to db via jndi connection</xsl:message>
<xsl:comment>Failed to connect to db via jndi connection</xsl:comment>
<xsl:if test="$debug = 'true'">
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
</xsl:if>
</xsl:when>
<xsl:otherwise><!-- Connect using connection string -->
<xsl:if test="not(sql:connect($connection, $driver, $datasource))">
<xsl:message>Failed to connect to db via driver/url connection</xsl:message>
<xsl:comment>Failed to connect to db via driver/url connection</xsl:comment>
<xsl:if test="$debug = 'true'">
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<!--
The results of the query. The rowset is brought back in 'streaming' mode,
so its not possible to ask it for the number of rows, or to check for zero
rows. There is a switch to disable streaming mode, but this requires all
rows to be brought into memory.
-->
<xsl:variable name="table" select="sql:query($connection, $query)"/>
<xsl:if test="not($table)">
<xsl:message>Error in Query</xsl:message>
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
<page>
<!-- Your xalan environment -->
<xsl:copy-of select="xalan:checkEnvironment()"/>
<!-- Build a bunch of metadata about the rows -->
<meta>
<cols>
<xsl:apply-templates select="$table/sql/metadata/column-header"/>
</cols>
</meta>
<rowset>
<!--
With streaming results, you must use the apply-temmplates contruct,
not for-each, since for-each seems to attempt to count the rows, which
returns zero.
-->
<xsl:apply-templates select="$table/sql/row-set"/>
</rowset>
</page>
<xsl:value-of select="sql:close($connection)"/><!-- Always close -->
</xsl:template>
<xsl:template match="row">
<row>
<xsl:apply-templates select="col"/>
</row>
</xsl:template>
<xsl:template match="column-header">
<col>
<xsl:attribute name="type">
<xsl:value-of select="@column-typename"/>
</xsl:attribute>
<xsl:attribute name="display-name">
<xsl:call-template name="create-display-name"/>
</xsl:attribute>
<xsl:value-of select="@column-name"/>
</col>
</xsl:template>
<!-- Convert column names to proper caps: MY_FIELD becomes My Field -->
<xsl:template name="create-display-name">
<xsl:variable name="col-name">
<xsl:for-each select="str:tokenize(@column-name, '_')">
<xsl:value-of
select="concat(translate(substring(., 1, 1), $lowercase, $uppercase), translate(substring(.,2), $uppercase, $lowercase), ' ')"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="substring($col-name, 1, string-length($col-name) - 1)"/>
</xsl:template>
<!-- Creates data columns named 'col' with a column-name attribute -->
<xsl:template match="col">
<col>
<xsl:attribute name="column-name"><xsl:value-of select="@column-name"/></xsl:attribute>
<xsl:value-of select="."/>
</col>
</xsl:template>
</xsl:stylesheet> -
Using XSLT "adapter" for invoking a WS with SOAP-ENC array type param.
Hello,
I had to write a BPEL process that calls inside it a web service which has as an input an array parameter and as an output, also an array. I already know that BPEL has limitations regarding using the SOAP-ENC Array type. I tried to rewrite the web service in order to use a literal encoding of the array parameters (using "maxOccurs" attribute), but unfortunately, the OC4J container 9.0.4 that I have to use doesn't allow this. It only allows the SOAP-ENC types for array types.
I started to write, inside the BPEL process, some "adapters" XSLT transformations before and after the invoking of the web service that uses SOAP-ENC array. The XSLT transformation before the web service invoking will translate the input array parameter defined with no SOAP encoding types (based on "maxOccurs" attribute) into a SOAP-ENC type, as it is expected by the web service. The XSLT transformation after the web service invoking will translate the returned array SOAP-ENC type into a data type defined with no SOAP encoding types (based on "maxOccurs" attribute).
The approach is pretty hairy, from the XSLT point of view and it introduces a supplementary delay due to the XSLT processing needed, but it works. The only think is that when I build the service, I obtain the following error message:
[bpelc] [Error] GCDBWebservice?WSDL:30:42: src-resolve.4.2: Error resolving component 'SOAP-ENC:Array'. It was detected that 'SOAP-ENC:Array' is in namespace 'http://schemas.xmlsoap.org/soap/encoding/', but components from this namespace are not referenceable from schema ...
But in spite of this, the process is built and deployed successfully and I was able to run it from the BPEL console.
Do you think that this approach could hide some other future problems that I can't see in this moment?
Thanks,
MarinelPlease help me for this.
I am new to Webservices and SOAP.
I am facing problem when i am calling a "add" method in the .net webservices with the following code but it gives correct result when i'm calling the "HelloWorld" method present in the webservice.
I think it will happening because, when i'm going to pass any parameter to the "add method , it does not process it.It will return me 0.
Please help me in this.
The code is:
import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.encoding.literalxml.*;
import org.apache.soap.rpc.*;
import org.apache.soap.transport.http.SOAPHTTPConnection;
import org.apache.soap.transport.*;
import org.apache.soap.messaging.*;
import org.apache.xerces.parsers.*;
import org.apache.xerces.dom.DocumentImpl;
public class testClient {
public static void main(String[] args) throws Exception {
URL url = new URL ("http://Eurotele-it3/webService1/Service1.asmx");
//Map the Types.
SOAPMappingRegistry smr = new SOAPMappingRegistry ();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("http://Eurotele-it3/WebService1/Service1","addResult"),Integer.class,null,sd);
// create the transport and set parameters
SOAPHTTPConnection st = new SOAPHTTPConnection();
// build the call.
Call call = new Call();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI ("http://Eurotele-it3/WebService1/Service1/add");
call.setMethodName("add");
//call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("x",Integer.class,"10",null));
params.addElement(new Parameter("y",Integer.class,"20",null));
call.setParams(params);
Response resp = null;
try {
resp = call.invoke (url,"http://Eurotele-it3/WebService1/Service1/add");
catch (SOAPException e) {
System.err.println("Caught SOAPException (" + e.getFaultCode () + "): " +e.getMessage ());
return;
// check response
if (resp != null && !resp.generatedFault()) {
Parameter ret =resp.getReturnValue();
Object value =ret.getValue();
System.out.println ("Answer--> " +value );
else {
Fault fault = resp.getFault ();
System.err.println ("Generated fault: ");
System.out.println (" Fault Code = " + fault.getFaultCode());
System.out.println (" Fault String = " + fault.getFaultString());
This is the complete WSDL format:
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://Eurotele-it3/WebService1/Service1" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://Eurotele-it3/WebService1/Service1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://Eurotele-it3/WebService1/Service1">
- <s:element name="HelloWorld">
<s:complexType />
</s:element>
- <s:element name="HelloWorldResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="HelloWorldResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="add">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="x" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="y" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="addResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="addResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
- <wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
- <wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
- <wsdl:message name="addSoapIn">
<wsdl:part name="parameters" element="tns:add" />
</wsdl:message>
- <wsdl:message name="addSoapOut">
<wsdl:part name="parameters" element="tns:addResponse" />
</wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
- <wsdl:operation name="add">
<wsdl:input message="tns:addSoapIn" />
<wsdl:output message="tns:addSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://Eurotele-it3/WebService1/Service1/HelloWorld" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="add">
<soap:operation soapAction="http://Eurotele-it3/WebService1/Service1/add" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address location="http://eurotele-it3/webService1/Service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions> -
Need help for Count function in XSLT Mapping
Hi All,
We have a requirement in our project,to do the xslt mapping from OAGIS 9.0 to EDI XML.In the EDI XML we have a SE tag whose value is the count of the no. of complex elements that will be generated in the EDIXML file( which is the target).
Please do let me know if anybody has done this functionality in the xslt mapping.
Thanks in Advance.
Regards,
KaavyaHi,
for the Hex-Number-conversion see:
[url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
What number format do you have? YYYMMDD
Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
Please describe further.
Bye
stratmo -
Is it possible to replace XSLT mapping in place of Graphical mapping
Is it possible to do XSLT mapping in place of Graphical mapping, in any normal scenario?
Means the fuctionality we do by using Graphical mapping(like the operations by using node functions etc...) could possible to do with XSLT Mapping?HI
yes it is possible to replace the graphical mapping with the XSLT mapping.
But using XSLTs degrade the performance of the interface and moreover they are not easily maintainable.
Refer the below links for assistance on XSLT Mapping:
XSLT MAPPING:
Generic XSLT Mapping for SAP XI,Part I
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
Generic XSLT Mapping for SAP XI,Part II
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
XSLT: Recursive Templates
XSLT: Recursive Templates
Easy RFC lookup from XSLT mappings using a Java helper class
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14
Step u2013 By u2013 Step Simple Approach for XSLT Mapping
Step By Step Simple Approach for XSLT Mapping
http://www.devguru.com/Technologies/xslt/quickref/xslt_element_applytemplates.html
XSLT Mapping
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
xpath functions in xslt mapping
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=xslt+mapping&adv=false&sortby=cm_rnd_rankvalue#
Using XSLT mapping in a ccBPM scenario
File to Multiple IDocs (XSLT Mapping)
Comparsion of Different mappings:
Comparing Performance of Mapping Programs
Complete mapping guide url:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
cheers -
HELP: JSP + XML + XSLT = HTML?
Hello, all.
I am trying out Weblogic 6 and I am trying to get the JSP + XML + XSLT =>
HTML chain working.
I am coming from using Orion and SAXON.. and in that situation I had a JSP
that contained XML tags... they were filled in at runtime and then using
Servlet-Chaining was passed along to the SAXON XSLT Processer. SAXON checked
for the inline XSL specified and then used that to transform the document
into HTML.
It worked well, but there were some other features missing/not documented
that we now need.
With Weblogic I am trying to use the XSLT Tag Library that comes with the
distribution, but it seems to be very finicky. I followed the directions and
I got it to do a sort of roundabout transformation. But it doesn't seem to
work quite right.
The best I can get is the following:
I have an 'xslt' directory url-pattern-mapped to xslt.jsp (as instructed)...
but can't figure out how to specify the xsl file on-the-fly... that is, if I
don't hard-code the XSL file in the x:xslt element in the xslt.jsp it
complains about some XML file not having a root element.
Ideal situation:
1. I have a JSP that includes XML elements.
2. It is filled from a database at runtime and specifys (using a PI) what
XSL stylesheet it is to be processed with.
3. Somehow (fingers crossed) the XML is processed and transformed into HTML
by the appropriate XSL file.
I think I am mostly stuck moving between steps 2 and 3.
Can anyone give me some hints? Are there some Weblogic specific
elements/tags that I have to include in the XML file that Weblogic will
catch and re-direct to the XSL Parser?
Please, anyone, if you have some information, I would much appreciate it.
Dylan Parker
PS - I apologize for the cross-post, I hope it doesn't cause too much
traffic.Craig,
I've since discovered how to do it with the WL Taglibrary... and have
moved on =)
It has to do with the EXTREMELY BADLY documented x:xml tag that can
appear within the x:xslt tag body...
So the WL Tag Library allows something like the following.
(Please note, angled brackets are omitted in this post to prevent html
parsing)
[x:xslt stylesheet="sheet.xsl"]
[x:xml]
Here is the XML to run the sheet on.
This should have all relevant XML syntax: the PIs, the doctype,
root elements etc...
[x:xml]
[x:xslt]
And that DOES work. But not very well. WL, a little prematurely
incorporated versions 1.2 of Xerces and Xalan in their product -- and
these versions have some irritating bugs.
Also -- There tag library doesn't copy the source XML across as UTF-8
.. so a lot of the Japanese I have embedded there (from a DB) gets
mangled somewhere in their code...
AND -- If you hammer a little bit on an JSP/XML that uses the WL Tag
Library (eg clicking refresh lots of times in IE)... I get huge
amounts of irritating exceptions appearing in the log files.
NullPointerExceptions
XSL Parsing Exceptions
XML Parsing Exceptions
but completely unpredictably...
In my eyes.. the WL XML/XSL Tag Library using the incorporated and
untouchable Xalan and Xerces (v1.2) is virtually unusable.
What a pain.
BUT! Apache offers a similar OPEN SOURCE XSL Tag Library available
here:
http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html
And it uses the standard, non-weblogic-incorporated, Xerces and Xalan
(which means you can provide whatever version you want).. and it works
impressively well.
It has almost identical performance as the WL Taglib, and without all
of the bizarre exceptions being thrown.
And it does proper passing of the character encoding type!
If only the taglib did caching though =(
The performance hit over pure JSP is huge. Almost two orders of
magnitude. On my desktop box I can get around 500Requests/Sec if I am
returning HTML direct from a JSP... while if I produce XML that gets
processed by XSL into HTML the Requests/Sec drops to 5!!!!
Caching. Caching. And more Caching. A lot of DiskIO is going on with
the XML/XSL/XHTML chain of events.
I hope this helps!
I'd be curious as to what you find out as well.
Dylan Parker
On 5 Mar 2001 07:20:00 -0800, "Craig Macha"
<[email protected]> wrote:
>
Yep, I feel Dylan's pain.
I am trying to accomplish the same thing. A JSP page generating
dynamic XML content and then utilizing an XSLT stylesheet to transform
all the content into XHTML.
Does anyone have some examples that show exactly how to accomplish
this? Can I do this with WLS and the XML taglib that comes with
it? Or do I have to move on to something like Cocoon to get this
capability?
Any insight would be greatly appreciated.
Thanks,
Craig Macha
"Dylan Parker" <[email protected]> wrote:
Hello, all.
I am trying out Weblogic 6 and I am trying to get the
JSP + XML + XSLT =>
HTML chain working.
I am coming from using Orion and SAXON.. and in that situation
I had a JSP
that contained XML tags... they were filled in at runtime
and then using
Servlet-Chaining was passed along to the SAXON XSLT Processer.
SAXON checked
for the inline XSL specified and then used that to transform
the document
into HTML.
It worked well, but there were some other features missing/not
documented
that we now need.
With Weblogic I am trying to use the XSLT Tag Library
that comes with the
distribution, but it seems to be very finicky. I followed
the directions and
I got it to do a sort of roundabout transformation. But
it doesn't seem to
work quite right.
The best I can get is the following:
I have an 'xslt' directory url-pattern-mapped to xslt.jsp
(as instructed)...
but can't figure out how to specify the xsl file on-the-fly...
that is, if I
don't hard-code the XSL file in the x:xslt element in
the xslt.jsp it
complains about some XML file not having a root element.
Ideal situation:
1. I have a JSP that includes XML elements.
2. It is filled from a database at runtime and specifys
(using a PI) what
XSL stylesheet it is to be processed with.
3. Somehow (fingers crossed) the XML is processed and
transformed into HTML
by the appropriate XSL file.
I think I am mostly stuck moving between steps 2 and 3.
Can anyone give me some hints? Are there some Weblogic
specific
elements/tags that I have to include in the XML file that
Weblogic will
catch and re-direct to the XSL Parser?
Please, anyone, if you have some information, I would
much appreciate it.
Dylan Parker
PS - I apologize for the cross-post, I hope it doesn't
cause too much
traffic.
Maybe you are looking for
-
I am a premium subscriber to AcornTV. I have been unable to stream video on my home MacBook Pro (OS 10.6.8) using Firefox 3.6.12. I can easily stream Hulu, iTunes, Netflix, etc, but NOT AcornTV. I have tried the AcornTV player on Safari, Chrome and F
-
Moving iTunes folder to an external drive. How ?
My pBook 17" is bloated with iPhoto PICS and iTunes music store purchases. Moving the photo library, and running it off of the LACIE external FW 800 drive was easy. Not with iTunes. I moved the entire iTunes folder to the external, but every time I l
-
Report to get correct posting date of material document?
I have material number (matnr) and plant (werks). Which report do I use to get posting date of material document (mkpf-budat) ? Thanks!
-
Can any tell me how can i study all these?
Good in Business Process/Functional Areas Requirements, GAP Analysis, Design, Configuration, Development, Testing, Deployment, Planning & Executing Data Conversion & User Training. Exposure to ASAP methodology, rollouts & upgrades. Does all these com
-
ITunes 10.7 not working with Internet Explorer 8 (Windows 7) - Help!
I downloaded iTunes 10.7 today after getting email update from iTunes <[email protected]>. After I installed newiTune 10.7 and try to launch the app, Windows gave a prompt saying "iTunes has stopped working. A problem caused the program to stop worki