Problem using XSLT & HTML Tags

Hi all,
I'm newbie using XML and XSL and i'm facing a problem that i would need some help.
I wrote a XML using servlet that use a XSL and transform it in a HTML output. So everything seems to work fine but when i try to use HTML tags inside my XSL it is not executed. it looks like below viewing by the browser IE6.0.
- <html>
- <body>
<b>Sun Sep 14 12:27:09 BRT 2003</b>
<i>Hello World</i>
</body>
</html>
The fact is that i want my HTML tags to be executed by the XSl file and do not simple show the tags. Can someone help me? I would appreciate any help since i've been spending long time with that without any answer.
Thanks and Regards
Fabio

following below the code that generate the XML. I still need help.
I hope someone can help me in this issue
The servlet that generate the XML.
response.setContentType("text/xml");
String Xml = "";
Xml = Xml + "<?xml version=\"1.0\"?>";
Xml = Xml + "<?xml-stylesheet href=\"/XslGravaCrit.xsl\" type=\"text/xsl\"?>";
Xml = Xml + "<!-- Here is a sample XML file -->";
Xml = Xml + "<page>";
Xml = Xml + "<title>Test Page</title>";
Xml = Xml + "<content>";
Xml = Xml + "<paragraph>What you see is what you get!</paragraph>";
Xml = Xml + "</content>";
Xml = Xml + "</page>";
try{
TransformerFactory tFactory = TransformerFactory.newInstance();
byte[] arr=Xml.getBytes();
ByteArrayInputStream bytes=new ByteArrayInputStream(arr);
Source xsl=new StreamSource("../XslGravaCrit.xsl");
Templates template=tFactory.newTemplates(xsl);
Transformer transformer = template.newTransformer();
transformer.transform(new StreamSource(bytes), new StreamResult(response.getWriter()));
}catch(Exception e){
System.out.println("Excecao 100: " + e.getMessage() + e.getLocalizedMessage());
The XSL XslGravaCrit.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output method="html" indent="yes" version="4.0"/>
<xsl:template match="page">
<html>
<body><b>
<xsl:value-of select="java:java.util.Date.new()"/>
     </b>
<xsl:for-each select="/page">
<xsl:sort select="paragraph"/>
<xsl:value-of select="paragraph"/>
</xsl:for-each>
<i>Hello World</i>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Similar Messages

  • How to use the HTML tags in the reports.

    hi.
    can any one tell me how to use the HTML tags in the reports.
    i m using the forms 10 g rel 2 and reports 10 g rel 2 and application server 10g rel 2.

    Set the Contains HTML Tags property of an object to Yes, then the tags in the object's text (if any) will be used to format the object.

  • Using the HTML tags in Oracle Alerts

    Hi all,
    Can we use the HTML Tags in Oracle Alerts at Alert Details window in Text(D) Column?
    Please Provide solution to format the data which is sending to Mail from Oracle Alerts.

    What version of ebusiness are you running? You should be able to utilise html tags without an issue in 11i.

  • Arabic characters appear as empty squares when using certain HTML tags or font styles

    Only when HW acceleration is on. Arabic characters appear as empty squares when using "italic" or "oblique" font styles or when using &lt;i&gt; or &lt;em&gt; html tags.
    Try this code to replicate the problem
    <pre>
    &lt;p&gt;مشكلة ظهور المربعات الخالية بدل الحروف&lt;/p&gt;
    &lt;p style="font-style: italic;">Italic مشكلة ظهور المربعات الخالية بدل الحروف&lt;/p&gt;
    &lt;p style="font-style: oblique;">Oblique مشكلة ظهور المربعات الخالية بدل الحروف&lt;/p&gt;
    &lt;i&gt;i tag مشكلة ظهور المربعات الخالية بدل الحروف</i> &lt;br&gt; &lt;br&gt;
    &lt;em&gt;em tag مشكلة ظهور المربعات الخالية بدل الحروف &lt;/em&gt;
    </pre>

    After lots of research, I found the problem. The boxes (squares) show up whenever there is a font in the webpage that does not have Arabic within its Unicode range such as Times New Roman Italic or Oblique. Normally, Firefox will pick another font to display the characters but now, a newly introduced feature is interfering.
    To fix the problem without turning off hardware acceleration.
    Go to about:config
    locate: gfx.font_rendering.directwrite.use_gdi_table_loading
    which is True by default in FF4.0 Beta 10, and change it to False.
    This is a bug that has to be fixed.

  • Struts portlet Instance Label problem: Appending the html tags in jsp

    I have created a struts portlet and given it a Instance Label. I have used struts-adapter-html.tld tld in my jsp which is referenced by my struts portlet. But the problem with using this taglib is that the portlet Instance Label is appended to all the html tags on the JSP as a result of which when the page is submitted, formbean will not pick any of the values as the name will not match. Has anyone has faced this kind of problem? How can I prevent the appending of the HTML tags with the portlet Instance Label?
    Please help me overcome this problem..
    Thanks in Advance ...

    1. To begin with, I would not recommend NOT to append portlet instance label to html tags. This is very much required. Take atleast 2 scenarios. If you dropped 2 instances for Same Portlet like News/Articles portlet etc on same page, you need to identify the html fields uniquely for each portlet so that backend java code works properly. Also if you have 2 different portlets assuming you did not give any name to form tag, and if you have html tags with same name, you need to identify them. Remember when portal or desktop is rendered, it is one big html file with html fragmetns from all .portlets files. So I am not sure if there is any option at all, to avoid the appending of instance label value to html tags.
    2. Coming to your usecase, I did had this problem once in 8.1 SPxx long back. All we did was, in the back end code, using BackingFile we could get the intance label value of the portlet. We can get this in pageflow also. Then pass this value and manually append this value to the html field of interest. In your case looks like you have Struts and tld tags. See somehow if you can get portlet instance label in jsp file and pass around to your tag lib code in request parameters etc. This is just one idea. I am not fully aware of your code, so try something along these lines.
    HTH
    Ravi Jegga

  • Problem in parsing HTML tag

    Hello,
    I want to parse the text in div ..like :<div id="title">Action Result</div>
    My code is :
    public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos){
    if (t == HTML.Tag.DIV){
      String page_title = (String)a.getAttribute(HTML.Attribute.ID);
      if (page_title != null){
         System.out.println("Title : " + page_title);
      public static void main(String argv[]) {
        try {
          Reader r = new FileReader("C://test1.html");
          ParserDelegator parser = new ParserDelegator();
          HTMLEditorKit.ParserCallback callback = new ParseTest();
          parser.parse(r, callback, false);
        } catch (IOException e) {
          e.printStackTrace();
      }But it does not work. Please advise how to do this.
    Thanks in advance.

    I also want to extract the html text from the tag like-
    <div id="title">Action Result</div>
    I want to take the "Action Result" as my programs output.
    Please help me to solve this problem.

  • Problem using JSTL XML tags.

    My xml tag is giving problems. All other tags (core/sql and EL) are working fine. Even a very simple code like :
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <!-- parse an XML document -->
    <x:parse var="simple">
    <a>
    <b>
    <c>C </c>
    </b>
    <d>
    <e> E </e>
    </d>
    </a>
    </x:parse>
    <!-- display using XPath expressions -->
    <x:out select="$simple//e"/>
    gives error as :
    javax.servlet.ServletException: Cannot inherit from final class
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
         org.apache.jsp.jsp.xml.first_jsp._jspService(first_jsp.java:65)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    Pls. help!

    Works with no problems for me. (same exact code posted into a JSP)
    Running on Tomcat 5, Java1.4
    What server are you running, and version of java?
    Is there anything else on the page? Are you extending a class somehow?
    Do you have any extra libraries in the web-inf/lib directory that might be conflicting?

  • Problem using pdk-html:multibox and pdk-html:checkbox

    Hi all,
    I am developing a PDK struts application using OC4J 10.1.2. I have to create some form pages which are going to have some checkboxes. I have tried to follow the following code in order to use the pdk version of the checkbox in my form:
    in jsp file
    <logic:iterate id="item" property="items">
    <pdk-html:multibox property="selectedItems">
    <bean:write name="item"/>
    </pdk-html:multibox>
    <bean:write name="item"/>
    </logic:iterate>
    Given an ActionForm setup like this
    private String[] selectedItems = {};
    private String[] items = {"UPS","FedEx","Airborne"};
    public String[] getSelectedItems() {
    return this.selectedItems;
    public void setSelectedItems(String[] selectedItems) {
    this.selectedItems = selectedItems;
    ....... //getters and setters of items//
    In the reset method I also reinitialize the selectedItems array like :
    selectedItems=new String[]{};
    But the value of the multibox is not reflected in the action class. To my surprise, the html code generated by the server is similar to ordinary checkbox which ideally should carry some portlet specific information like pdk-html:text
    Same is the case with single checkbox. I have created a boolean variable for the single checkbox in the actionForm class. But same problem frustrates me again. The value is not passed simply.
    Can anybody comment. Is this some kind of a bug or may be there is no support for checkbox and multibox in pdkstruts.jar (10.1.2.0.2).
    Best regards,
    Omer

    following below the code that generate the XML. I still need help.
    I hope someone can help me in this issue
    The servlet that generate the XML.
    response.setContentType("text/xml");
    String Xml = "";
    Xml = Xml + "<?xml version=\"1.0\"?>";
    Xml = Xml + "<?xml-stylesheet href=\"/XslGravaCrit.xsl\" type=\"text/xsl\"?>";
    Xml = Xml + "<!-- Here is a sample XML file -->";
    Xml = Xml + "<page>";
    Xml = Xml + "<title>Test Page</title>";
    Xml = Xml + "<content>";
    Xml = Xml + "<paragraph>What you see is what you get!</paragraph>";
    Xml = Xml + "</content>";
    Xml = Xml + "</page>";
    try{
    TransformerFactory tFactory = TransformerFactory.newInstance();
    byte[] arr=Xml.getBytes();
    ByteArrayInputStream bytes=new ByteArrayInputStream(arr);
    Source xsl=new StreamSource("../XslGravaCrit.xsl");
    Templates template=tFactory.newTemplates(xsl);
    Transformer transformer = template.newTransformer();
    transformer.transform(new StreamSource(bytes), new StreamResult(response.getWriter()));
    }catch(Exception e){
    System.out.println("Excecao 100: " + e.getMessage() + e.getLocalizedMessage());
    The XSL XslGravaCrit.xsl
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"
    version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:output method="html" indent="yes" version="4.0"/>
    <xsl:template match="page">
    <html>
    <body><b>
    <xsl:value-of select="java:java.util.Date.new()"/>
         </b>
    <xsl:for-each select="/page">
    <xsl:sort select="paragraph"/>
    <xsl:value-of select="paragraph"/>
    </xsl:for-each>
    <i>Hello World</i>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Character encoding problem using XSLT and Tomcat on Linux

    Hi,
    I have an application running on a Tomcat 4.1.18 application server that applies XSLT transformations to DOM objects using standard calls to javax.xml.transform API. The JDK is J2SE 1.4.1_01.
    It is all OK while running on a development enviroment (which is Windows NT 4.0 work station), but when I put it in the production enviroment (which is a red hat linux 8.0), it comes up with some kind of encoding problem: the extended characters (in spanish) are not shown as they should.
    The XSL stylesheets are using the ISO-8859-1 encoding, but I have also tried with UTF-8.
    These stylesheets are dynamicly generated from a JSP:
    // opens a connection to a JSP that generates the XSL
    URLConnection urlConn = (new URL( xxxxxx )).openConnection();
    Reader readerJsp = new BufferedReader(new InputStreamReader( urlConn.getInputStream() ));
    // Gets the object that represents the XSL
    Templates translet = tFactory.newTemplates( new StreamSource( readerJsp ));
    Transformer transformer = translet.newTransformer();
    // applies transformations
    // the output is sent to the HttpServletResponse's outputStream object
    transformer.transform(myDOMObject, new StreamResult(response.getOutputStream()) );Any help would be appreciated.

    Probably you need to set your LANG OS especific environment variable to spanish.
    Try adding this line:
    export LANG=es_ES
    to your tomcat/bin/catalina.sh, and restart tomcat.
    It should look like this:
    # OS specific support.  $var _must_ be set to either true or false.
    cygwin=false
    case "`uname`" in
    CYGWIN*) cygwin=true;;
    esac
    export LANG=es_ES
    # resolve links - $0 may be a softlink
    PRG="$0"
    .(BTW, keep using ISO-8859-1 encoding for your XSL)
    HTH
    Un Saludo!

  • WAD Using Frameset html tag in a web template

    I try to create a web template with 3 frames (Header, Navigation and body) with <frameset> tag and when i try to upload the html file to the server I get the error:
    Run time error:
    Invalid Colunm name or number

    Here is a sample of our BW HomePage HTML which is a frameset with 4 frames: Banner, Role Menu(report tree), Body (text), Links.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 2</title>
    <link rel="stylesheet" href="Mime/BEx/StyleSheets/BWReports.css" type="text/css">
    </head>
    <frameset rows="53,*" framespacing="4" border="0" frameborder="0">
      <frame name="banner" scrolling="no" noresize target="contents" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&cmd=ldoc&TEMPLATE_ID=ZP_BW_ROLE_MENU_BANNER" marginheight="0" marginwidth="0">
      <frameset cols="31%,*,25%">
        <frame name="contents" target="main" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&cmd=ldoc&TEMPLATE_ID=ZP_BW_ROLE_MENU_CONTENTS" scrolling="auto" style="border: 3px solid #C0C0C0">
        <frame name="main" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&cmd=ldoc&TEMPLATE_ID=ZP_BW_ROLE_MENU_BODY" scrolling="auto" style="border-right: 3px solid #C0C0C0; border-top: 3px solid #C0C0C0; border-bottom: 3px solid #C0C0C0">
        <frame name="links" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&bsplanguage=EN&CMD=LDOC&TEMPLATE_ID=ZP_BW_ROLE_MENU_LINKS" scrolling="auto" noresize style="border-right: 3px solid #C0C0C0; border-top: 3px solid #C0C0C0; border-bottom: 3px solid #C0C0C0" marginwidth="5" marginheight="15">
      </frameset>
      <noframes>
      <body>
      <p>This page uses frames, but your browser doesn't support them.</p>
      </body>
      </noframes>
    </frameset>
    </html>
    ***NOTE:  You cannot edit this HTML in WAD in Layout Mode, ONLY HTML MODE.  Another way to maintain template HTML code is via Report RS_TEMPLATE_MAINTAIN.
    Hope that helps,
    Don May

  • Problems using scriptlets as tag parameters

    Greetings:
    I have a custom tag called genrl:viewData which receives as its (required) argument a string called "ID". Essentially, the tag works as follows:
    <genrl:viewData ID="8989" /> where the value of the ID points to something in a database.
    I have discovered that as long as I pass an explicit string (like "8989") to ID all seems to go well. Unfortunately, I'd like to use a scriptlet -- for example:
    <% String ident = "8989"; %> (or something else, like a parameter)
    <genrl:viewData ID="<%= ident %>"/>
    According to the documentation and the books on JSP, Ishould be able to do something like this. Unfortunately, whenever I attempt to pass a scriptlet to my tag, my JSP container generates the following compilation error:
    Mon Jan 27 16:19:11 EST 2003:<I> <WebAppServletContext-LS> failed to compile /item/InterventionView.jsp, compiler errors:
    C:\weblogic\ls1\.\CDLM\LS\WEB-INF\_tmp_war_LS\jsp_servlet\_item\__interventionvi
    ew.java:87: unclosed string literal
    comjsptags_general_GetInterventionTag_0.setID(weblogic.utils.StringUtils.valueOf("<%= ident //[ /item/InterventionView.jsp; Line: 32]
    ^
    C:\weblogic\ls1\.\CDLM\LS\WEB-INF\_tmp_war_LS\jsp_servlet\_item\__interventionvi
    ew.java:88: ')' expected... (and a bunch of other irelevant stuff)
    I have tried enclosing the scriptlet in single quotes, double quotes, and I've even tried using backslashes at strategic places. Nothing seems to prevent this error.
    Could someone please advise? How can one pass a scriptlet value to a tag without getting these errors??? Or have I found a bug in the several books and in Sun's documentation of tag libraries???
    Any advice on this matter would be appreciated.
    -Factor Three

    Make sure you have set the paramater to scripable in the tld file:
        <tag>
        <name>DispatchFieldDisable</name>
        <tagclass>KioskTags.AssignmentTags.DispatchFieldDisable</tagclass>
        <info>Disable fields already populated with valid values in Dispatch form </info>
            <attribute>
                    <name>inField</name>
                    <required>true</required>
                    <rtexprvalue>true</rtexprvalue>
           </attribute>
            <attribute>
                    <name>mode</name>
                    <required>false</required>
                    <rtexprvalue>true</rtexprvalue>
           </attribute>
        </tag> <P>
    <kiosk:DispatchFieldDisable inField="<%=DispatchFieldDisable.ALL%>" mode="<%=DispatchFieldDisable.TITLE%>"> </kiosk:DispatchFieldDisable>

  • Problem using Tomahawk inputDate tag

    When I enter a blank value for any of the dropdowns in the inputDate component anerror is generated by the component and I can display the errorMessage using
    <t:message for="myDate" errorClass="validationMessage" infoClass="infoMessage"/>My question is is there any way to stop the validation happening or better still to remove the "blank" options from the dropdowns. I know there are emptyAmpmSelection/emptyMonthSelection where you can define what you want the blank to appear as but I just want the time dropdown to be AM or PM, nothing else. I can't even try to imagine why the blanks are there in the first place.
    Thansk ... J

    Just preselect the dropdown menu.
    E.g.<h:selectOneMenu value="#{myBean.selectedItem}">
    public MyBean() {
        this.selectedItem = "Use here the same value as one of the selectItem objects.";
    }

  • How to use add image in HTML tag

    Hello frndz
                     i  m working on text chat application in adobe  air.using <mx:html/> tag for dispalying text and  images(smiley).but the font size fo flex is diffrent and html diffrent.i  mean i m using 10 font size but it looks too large on  <mx:html/>  component.is there any way to cast them in same size.
    The second and major problem is that it can not add images to html  tag.when i m giving images like:-private var txt:String="<img  src='src\smily\tongue.gif'/>" .
    it shows nothing but when i give images through http path it shows  images on html componenet.
    can any body explain me the problem.
    Thanks And regards
      Vineet Osho

    thanks Alot René Bühling for  your quick reply.but the link u mentioned ith reply is not working for  me.
    ok can u tell me how can i manage my flex font  size 10 to  <mx:html tag 's font size 10.
    i think there is large difference  between flex font and html font.so please guide me for that.
    Thanks  Alot
    Vineet osho

  • Struts bean/html tag problem

    i am writing this url_element on screen
    <bean:write name="url_element"/>
    then i got a link
    <html:link action="urlDetail.do?url=???">aaa</html:link>
    how can i transfer the url_element into ??? do i need to write something like <%...%>?

    just found the solution:
    You can't use a <bean:write> tag inside an <html:link> tag. Struts doesn't support it.
    The easiest way to fix this is to abandon use of <html:link> and just use the plain old html tags <a></a>. Then you will have no problem substituting parameters with <bean:write> tags.
    The only advantage <html:link> has over the plain html tag is that it automatically does URL rewriting (Adding of the jsessionid to the URL so that sessions may be tracked even if the user has turned cookies off). If you're not using this function anyway, as most modern websites don't, you may as well use the html tag.
    If you still want to use <html:link>, use the struts-el version of the html tags and use EL expressions instead of <bean:write> tags.

  • Sending an email with html tags in it using apex_mail.send

    Hello,
    I am using APEX_MAIL.SEND to send emails from my apex applications.
    now I need the email body to have html features: bold, underline, colors etc.
    If I use regular html tags, they show up in the email.
    How can this be done?
    Thanks
    Rani

    Hi, try
    p_body_html
    and it should display just fine :)

Maybe you are looking for