Xslt extension

I'm looking to write an Xslt extension to help produce Html-output. For part of the tags produced, some information in the Xml needs to be checked and the output changed accordingly. The idea I had was to dynamically add a piece of xsl to each stylesheet used. The question is rather simple: What's the "cleanest" way of writing a thing like this? So that there would be least possible "obscuration" of the code in the different stylesheets?
Tommy Sedin

Combining the XSLs isn't the problem. Calling the
templates inside the "extension stylesheet" in a nice
and clean way is. I hate having 4-5 lines of code to
call a template, when it should be possible to have
just 1.XML is a verbose language, isn't it?
I appreciate your answers, but - as I said in my
previous post - you're giving solutions to something
that is already solved without even touching the
problem I actually need help with. And I'm sorry if
I'm making "smart ass comments", but I don't much
appreciate you attacking my skills as a programmer and
systems architect. There is a reason why I've solved
something in a harder, more clumsy way than what
everyone else does.Yes, people always have their reasons for doing things. And sometimes those reasons are bad reasons. Questioning a design is not an attack, it's just a question. So there's no need to take it personally. However, I really didn't read your first reply properly, and that didn't help.

Similar Messages

  • ABAP XSLT Extensions or XSLT (XI imported archive)?

    Hi all,
    I would like to know which is having better performance in a scenario with a significant number of messages.
    I know that ABAP XSLT Extensions is based in XSLT 1.0 and have some features of XSLT 2.0. So, for me it means some limitations and a disadvantage compared with all of XSLT 2.0 “standard” can offer.
    But, my question is related with performance and I just want to know which is faster.
    Thanks in advance,
    Cheers,
    Ricardo.

    Hi Ricardo,
    abap xslt has one great advantage
    abap stack does not have to communicate with
    java stack to perform the - so no RFC calls for mapping
    with many messages that might influence their flows
    but it wuold be best if you could just test it
    in YOUR environment (there are many test tools -
    like Loadrunner from Mercury) or you can write your own scripts
    and just test in your particular examle which one is better
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Overloaded Java methods in XSLT extensions?

    Hello,
    when using Java classes as XSLT extensions, is it possible to use overloaded methods at all? I get "XSL-1042: Extension function error: Overloaded method 'format'" when doing that.
    I studied Steve Muench's book, pages 607-611, and came up with the following:
    Declared namespaces: "Date" for java.util.Date, "DateFormat" for java.text.DateFormat.
    Declared XSL variables: "now" as "Date:new()", "datefmt" as "DateFormat:getDateInstance()".
    Value of "Date:toString($now)" works fine. However, value of "DateFormat:format($datefmt, $now)" causes the XSL-1042 error.
    Is there any way around this?
    --Jere
    null

    The way around it is to create a wrapper function yourself that doesn't depend on overloading, and then exploit the overloading within your wrapper function call.

  • ESB XSLT Extension Functions

    Hi
    Could anybody tell me if we can use log4j in the java class which we write for XSLT Extension Functions which will be used in ESB XSL mappings?
    It is not recognizing log4j only.It is not giving any error also.
    Thanks
    Praveena

    Thanks Kanchan.
    This is talking about how to implement Extension functions.
    I have done this. but my question I am not able to use log4j for debugging purpose in this java class. It is not recognising this.
    We need to use logger instead of System.out.println .
    Thanks
    Praveena

  • Where to put property files used by XSLT extensions?

    Still fighting with Java XSLT extensions. I have narrowed the
    problem down: my XSLT extension cannot find its property file,
    which I use to store JDBC connect strings etc.
    What is the proper directory to put this file so the XSLT
    extension class can find it? I am using Oracle HTTP Server with
    XDK 9.0.

    Thanks for the answer, Steve!
    Depends on what call you're using in your extension function to
    read your properties.Maybe I tried a too simplistic approach. I'm just using this:
    Properties props = new Properties();
    try {
    props.load(new FileInputStream("/foo.properties"));
    etc.
    This (with the slash) works if the properties file is in the root
    directory of the filesystem, but it's a kludge.
    If you read your properties as a resource using
    getResourceAsStream(), then where the classloader expects to
    find your file depends on the resource name that you specify.So maybe I should use getResourceAsStream() then? What if I put
    the properties file inside the JAR with the extension classes?
    Or is there any way to reference the web root?
    --Jere

  • Cant resolve class on XSLT Extension

    I have XSLT and I am trying to call a java method and I get
    java.lang.NullPointerException
    at oracle.xml.parser.v2.XSLExtFunctions.getClass(XSLExtFunctions.java:351)
    Trying even a simple example using java.lang.xxxx gets the same error.
    <!-- x.xsl: show value in Hexadecimal -->
    <xsl:stylesheet version="1.0" exclude-result-prefixes="Int"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:Int="http://www.oracle.com/XSL/Transform/java/java.lang.Integer">
    <xsl:template match="/">
    <xsl:variable name="x" select="99"/>
    <!-- Invoke public static toHexString() method on current node "." -->
    <x-hex><xsl:value-of select="Int:toHexString($x)"/></x-hex>
    </xsl:template>
    </xsl:stylesheet>
    This is XDK 9.2.0.6
    Thanks in advance.

    Terris Linenbach (guest) wrote:
    : Does the v2 parser support XSLT extension functions?
    : Here is a cool example of an implementation at
    : http://www.jclark.com/xml/xt.html :
    : A call to a function ns:foo where ns is bound to a namespace
    of
    : the form http://www.jclark.com/xt/java/className is treated as
    a
    : call of the static method foo of the class with fully-
    qualified
    : name className. Hyphens in method names are removed with the
    : character following the hyphen being upper-cased. Overloading
    : based on number of parameters is supported; overloading based
    on
    : parameter types is not. A non-static method is treated like a
    : static method with the this object as an additional first
    : argument. A constructor is treated like a static method named
    : new. Extension functions can return objects of arbitrary types
    : which can then be passed as arguments to other extension
    : functions or stored in variables.
    : For example, the following
    : <xsl:stylesheet
    : xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
    : xmlns:date="http://www.jclark.com/xt/java/java.util.Date"
    : xmlns="http://www.w3.org/TR/REC-html40"
    : result-ns="">
    : <xsl:template match="/">
    : <html>
    : <xsl:if test="function-available('date:to-string') and
    : function-available('date:new')">
    <xsl:value-of select="date:to-string(date:new
    ())"/></p>
    : </xsl:if>
    : </html>
    : </xsl:template>
    : </xsl:stylesheet>
    : will print out the current date.
    Our current release 2.0.2 does not support extension functions
    but they will be supported in the very near future.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Xalan xslt extension flat file to xml...

    anyone used the xsltflat 2.0 to do flat to xml transformation? it does it by using xalan extension...
    the packate is com.fs.xalan.extensions.* and test.com.fs.xalan.extensions.*
    anyway, it works fine when I do it from command prompt... however when I tried to do it by calling it over Tomcat, the parsing gives me following funny error:
    file:///e:/test.xsl; Line 21; Column 92; javax.xml.transform.TransformerException: For extension function, could not find method java.io.FileInputStream.streamIterator([ExpressionContext,] #STRING).
    here is the seciton of the xsl file:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              version="1.0"
              xmlns:lxslt="http://xml.apache.org/xslt"
              xmlns:stream="com.fs.xalan.extensions.StreamTools"
              xmlns:txt="com.fs.xalan.extensions.TextFormatting"
              extension-element-prefixes="stream txt">
         <lxslt:component prefix="stream" elements="" functions="fileReader tokenize">
              <lxslt:script lang="javaclass" src="xalan://com.fs.xalan.extensions.StreamTools"/>
         </lxslt:component>
         <lxslt:component prefix="txt" elements="" functions="trim ltrim rtrim lpad rpad trunc replace strip stripPunc stripWS upcase downcase">
              <lxslt:script lang="javaclass" src="xalan://com.fs.xalan.extensions.StreamTools"/>
         </lxslt:component>
         <xsl:param name="inputStream" />
         <xsl:template match="/">
              <Employees>
                   <xsl:variable name="infile" select="stream:streamIterator($inputStream,'&#13;&#10;')" />
                   <xsl:apply-templates select="$infile/stream/line" />
              </Employees>
         </xsl:template>
    i know for sure the xsl works... there is nothing with wrong with xsl... so i am scratching my head right now...
    thanks...

    Tomcat also uses XML (for the setting files) and thus: ships with an XML processor. My best guess: your application requires some more recent parser, but the Tomcat provided stuff is found first, and used. Maybe the TransformerException was the result of the famous "Sealing violation" or "Nu such method".
    To check if this is the problem: make sure that your new xalan.jar file and (optionally) xerces.jar are in pole position in the class path.
    If you happen to use Borland JBuilder: there are two places where you set the order of the required libraries: in the main project settings and in the Project, Run, JSP/Servlet, Server Options, button setup. Here, add your own xalan.jar and xerces.jar as well, and put them on top of the list.
    a.

  • XSLT extension method in bpel

    Can someone please tell me how to extend the existing xslt file.
    I have a scenario where in customer will add new fields(as a ADF flex fields) and that will be taken(appended) in an xml file(will be added in EO and exposed as a service to BPEL).
    Now the customer should add the mappings to the newly added elements(customizable xslt in bpel) and this should get appended to the existing mapper file(base composite).
    Please help
    Edited by: 806493 on Oct 30, 2010 11:29 PM
    Edited by: 806493 on Oct 30, 2010 11:30 PM
    Edited by: 806493 on Oct 30, 2010 11:32 PM

    Create another XSLT and refer the new XSLT in the old one using the xsl:import option. You can define templates in the new XSLT and have them called from the old XSLT.
    Cheers,
    - AR

  • Thread safe XSLT extension

    We have a servlet that gets called with a set of parameters. I want to set one of those parameters within my XSL extensions so that it is retrievable from the XSL code. Because the extensions are static and used by all XSL transforms, they are not thread safe. Static elements within the class are overwritten by whatever servlet thread last touched it. So my parameter may not be for the thread wanted, but some subsequent thread. How can I get around this without synchronization?

    Would you provide more details of how you define the extensions?

  • XSLT extension function probelm

    Hi, I have some problems when I tried to migrate from Xalan to Oracle XSLT engine.
    I have to traverse a huge XML document, the usual XPath is rather slow so we developed a Java class that kept a reference to some of the important Nodes.
    The XSL looks like
    <xsl:variable name="password">
    <xsl:value-of select="customJavaClass:customFunctionReturningNode()/password/@value"/>
    </xsl:variable>
    After the call to the static function stays a valid XPath. That worked fine with Xalan but with Oracle I get something like "unexpected EOF".
    Any ideas?
    null

    The whole application is based on heavy usage of XSL. Tens of transformations are done just for one user. We are trying to optimize as much as possible the memory usage and the speed. Using top-level stylesheet variables is too much memoty consumption (we tried it).
    I don't think the code returning the Node Object is of importance. It is not even called (I inserted debug statements). I guess the problem is while the Oracle XSL processor is analyzing the XSL.
    I'll try these keys that you are suggesting. Is there any URL I can retrieve additional information and performance analysis for these keys?

  • Writing an XSLT Extensions

    About 20 times on every page I use the following
    xsl:value-of select = "page_content/dictionary/row[language=lang]/SOME_LABEL"
    Where SOME_LABEL is the name of a localized label to go on the html page.
    I want to shortcut this becuase I am lazy and I thought of an XSLTExtension like
    xsl:dictionary select="subject"
    but I cant see how to do this, all the xslt classes in the xmlparser are private so I cant extend them or reference them or duplicate them without practicaly rewriting the whole processor...
    Any ideas on how I might achieve this..
    Rob
    null

    I guess its rare for the data to be repeated in a single stylesheet.
    Basically its all the static text on a normal page, we do all our pages in four languages and use a "dictionary" to place the static text into the page.
    When we did this in .ASP we just had a single function that loaded the all the values into individual variables, fast and effecient.
    There isnt such an equivalent in XSLT from what I can see.
    Will look into keys though..
    Tks
    Rob

  • XSLT Redirect extension in SAP PI

    Hi,
    We are trying to use XSLT redirect function PI 7.11 mapping. I can't find the actual class path name for Redirect class XSLT processor used in PI which I believe is XALAN.
    The XSLT syntax i am trying is:
    ?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"               
                        xmlns:redirect="com.sun.org.apache.xalan.xslt.extensions.Redirect"
                        extension-element-prefixes="redirect"> 
    <redirect:write>
    <redirect:write>
    When I test this mapping I am getting following error message.
    javax.xml.transform.TransformerException: Unrecognized XSLTC extension 'com.sun.org.apache.xalan.xslt.extensions.Redirect:write' at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.postErrorToListener(TransformerImpl.java:717) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:669)
    I just need to know the correct class path name in xmlns:redirect attribute.
    Can anyone please let me know location of Java docs for com.sun.org.apache.xalan package?

    We are trying to use XSLT redirect function PI 7.11 mapping. I can't find the actual class path name for Redirect class XSLT processor used in PI which I believe is XALAN.
    This is not possible and does not make any sense at all. You cannot redirect the output inside a PI mapping.

  • XSLT mapping throws error in XI, but not in XMLSPY

    Hi everybody,
    I got a really complex XSLT mapping. It works fine in XMLSPY.
    But when I execute the mapping in XI, I get the following error:
    Error during XSLT Transformation: Could not load stylesheet.com.sap.engine.lib.xml.util.NestedException: Operator or ')' expected.
    I asume there is a special character that XI cannot execute.
    has anybody an idea of finding this character?
    Thanks, regards Mario

    Hi Mario
    Check your input data, and also try to see test in Interface mapping test tab,
    you will get an idea about the input is correct or not
    see the below links..
    <u><b>XSLT Mapping</b>[/u
    /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
    /people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    <u><b>XSLT Mapping with java enhancement</b></u>
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping - Using ABAP XSLT Extensions for XI Mapping
    Cheers..
    Vasu
    <i>** Reward Points if found useful **</i>

  • External methods in xslt mapping

    can we call external JAVA and ABAP methods in XSLT mapping ? 
    thanks
    kumar

    Kumar,
    Yes you can, please refer the below webelogs.
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Best regards,
    raj.

  • Give me description for ABAP and XSLT and JAVA Mapping

    i want detailed description for XSLT AND ABAP,JAVA Mapping and where they require coding and some examples for this items and differences for these mappings and message mapping and some examples which shows difference between these items

    Hi,
    Java mapping:
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    ABAP Mapping:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    XSLT mapping
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    ABAP XSLT mapping
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping
    Regards
    Vijaya

Maybe you are looking for

  • Internet (3G) does not work after update on 7.0.5 IPhone 5S

    Hi guys, I have a huge problem with my IPhone 5S... After update on 7.0.5 cell data/3G works awfully slow, I can only use Facebook but without pictures. I have tried restoring my phone but no change. I am desperate, please help:)

  • File Content Conversion - Multiple KeyField

    Hi Experts, I have the following structures with 2 keyfields <Structure1>   keyfield1 - value 1   keyfield2 - value 1 <Structure2>   keyfield1 - value 1   keyfield2 - value 2 <Structure3>   keyfield1 - value 2   keyfield2 - value 1 <Structure4>   key

  • MPP with cyrilic filenames are not opening from SP2013 library

    Hello! I have trouble opening mpp-files from Sharepoint 2013 Server document library. When opening from library (simply by clicking on file), Project Professional gives me an error, meaning that Project can't recognize file format: So, Project Pro of

  • Automatically Assign Control Key for External Assignment

    Hi All, Please can someone advise how I automatically assign the External Processing Control Key at the operation level using the Work Centre. I have a Main Work Centre set up which is linked to every Functional Location. This Work Centre has a defau

  • Process is running  in sm50

    Dear All, In sm50 i see one process is running from last 2 days. running        Yes           SAPLTHFB But in sm37  there is no process running. Please guide. Thanks & Regards Kumar