XSLT, problem with HTML

Hi,
I am using XSLT to generate a webpage using an XML file and a stylesheet. The HTML page is created fine however any HTML tag i.e. the break line tag comes out in the file as &lt.;BR&gt.; rather then <.BR.> (ignore the dots, just there so the form doesnt show them incorrectly). Any suggestions? Here is my code:
XML FILE
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?><transcript xsi:noNamespaceSchemaLocation="transcript-internal.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<section title="Outlook">
<question>question<BR></question>
<answer>answer</answer>
</section>
<disclaimer>disclaimer</disclaimer>
</transcript>
            TransformerFactory tFactory = TransformerFactory.newInstance();
            File stypePathFile = new File(stylePath);
            if (!stypePathFile.exists())
                 logger.severe("cannot transform transcript..stylesheet does not exist at this path " + stylePath);
            StreamSource stylesource = new StreamSource(stypePathFile);
            Transformer transformer = tFactory.newTransformer(stylesource);
            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            transformer.setOutputProperty(OutputKeys.ENCODING, charEnc);
            transformer.setOutputProperty(OutputKeys.METHOD, "html");
            byte bytes[] = dataXML.getBytes();
            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            StreamSource dataSource = new StreamSource(bais);
            StreamResult outputResult = new StreamResult(new File(outputPath));
            transformer.transform(dataSource, outputResult);
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser
            logger.severe("configuration error while transforming transcript: " + tce.getMessage());
        } catch (Exception e) {
            // Error generated by the parser
             logger.severe("error while transforming transcript: " + e.getMessage());
    }  The XML file is created using the following code:
import org.xml.sax.*;
import org.xml.sax.helpers.*;
public class TranscriptFilter extends XMLFilterImpl {
     public static final String SECTION_PREFIX = "+s:";
     public static final String QUESTION_PREFIX = "+q:";
     public static final String ANSWER_PREFIX = "+a:";
     public static final String DISCLAIMER_PREFIX = "+d:";
     public static final String IMAGE_PREFIX = "+i:";
     public static final String NARRATION_PREFIX = "+n:";
     public static final String PREFIX_REG_EXP = "(?m)(?=\\+[sqaidn]:)";
     public static final String TRANSCRIPT_TAG = "transcript";
     public static final String SECTION_TAG = "section";
     public static final String TITLE_TAG = "title";
     public static final String NARRATION_TAG = "narration";
     public static final String QUESTION_TAG = "question";     
     public static final String ANSWER_TAG = "answer";
     public static final String DISCLAIMER_TAG = "disclaimer";
     public static final String IMAGE_TAG = "image";
     public static final String URL_TAG = "url";          
     // schema validation tags
     public static final String SCHEMA_LOCATION_TAG = "xsi:noNamespaceSchemaLocation";
     public static final String SCHEMA_LOCATION_VALUE = "transcript-internal.xsd";     
     public static final String SCHEMA_INSTANCE_TAG = "xmlns:xsi";
     public static final String SCHEMA_INSTANCE_VALUE = "http://www.w3.org/2001/XMLSchema-instance";
     private boolean inSection = false; // is section tag open but not closed
     public void parse(String pText) throws SAXException {
          String text = pText;
          String line = null;
          String prefix = null;
          if (text != null) {
               String[] elements = text.split(PREFIX_REG_EXP);
               if (elements != null) {
                    AttributesImpl mainAtts = new AttributesImpl();
                    mainAtts.addAttribute("", SCHEMA_LOCATION_TAG, SCHEMA_LOCATION_TAG, null, SCHEMA_LOCATION_VALUE);                    
                    mainAtts.addAttribute("", SCHEMA_INSTANCE_TAG, SCHEMA_INSTANCE_TAG, null, SCHEMA_INSTANCE_VALUE);
                    startElement("", TRANSCRIPT_TAG, TRANSCRIPT_TAG, mainAtts);
                    for (int i = 0; i < elements.length; i++) {
                         if (elements[i] != null)
                              line = elements.trim();
                              if (line.length() > 3) {
                                   // return prefix to determine line data type
                                   prefix = getPrefix(line);
                                   line = removePrefix(line);
                                   if (prefix != null) {
                                        if (prefix.equalsIgnoreCase(SECTION_PREFIX)) {
                                             closeSection(); // close section if open
                                             AttributesImpl fieldAtts = new AttributesImpl();
                                             fieldAtts.addAttribute("", TITLE_TAG, TITLE_TAG, null, line);
                                             startElement("", SECTION_TAG, SECTION_TAG, fieldAtts);
                                             inSection = true;
                                        else if (prefix.equalsIgnoreCase(NARRATION_PREFIX)) {
                                             startElement("", NARRATION_TAG, NARRATION_TAG, new AttributesImpl());
                                             characters(line);
                                             endElement("", NARRATION_TAG, NARRATION_TAG);
                                        else if (prefix.equalsIgnoreCase(IMAGE_PREFIX)) {
                                             AttributesImpl fieldAtts = new AttributesImpl();
                                             fieldAtts.addAttribute("", URL_TAG, URL_TAG, null, line);
                                             startElement("", IMAGE_TAG, IMAGE_TAG, fieldAtts);
                                             endElement("", IMAGE_TAG, IMAGE_TAG);
                                        else if (prefix.equalsIgnoreCase(QUESTION_PREFIX)) {
                                             startElement("", QUESTION_TAG, QUESTION_TAG, new AttributesImpl());
                                             characters(line);
                                             endElement("", QUESTION_TAG, QUESTION_TAG);
                                        else if (prefix.equalsIgnoreCase(ANSWER_PREFIX)) {
                                             startElement("", ANSWER_TAG, ANSWER_TAG, new AttributesImpl());
                                             characters(line);
                                             endElement("", ANSWER_TAG, ANSWER_TAG);
                                        else if (prefix.equalsIgnoreCase(DISCLAIMER_PREFIX)) {
                                             closeSection(); // close section if open
                                             startElement("", DISCLAIMER_TAG, DISCLAIMER_TAG, new AttributesImpl());
                                             characters(line);
                                             endElement("", DISCLAIMER_TAG, DISCLAIMER_TAG);
                    closeSection(); // close section if open
                    endElement("", TRANSCRIPT_TAG, TRANSCRIPT_TAG);
     // closes the section tag if open
     private void closeSection() throws SAXException {
          if (inSection)
               endElement("", SECTION_TAG, SECTION_TAG);
          inSection = false;
     // overrides super class method
     private void characters(String pLine) throws SAXException {
          if (pLine != null) {
               char[] chars = pLine.toCharArray();
               super.characters(chars, 0, chars.length);
     // returns the prefix for a line
     private String getPrefix(String pLine) {
          String line = pLine;
          String prefix = null;
          if (validLine(line))
               prefix = line.substring(0,3);
          return prefix;
     private String removePrefix(String pLine) {
          String line = pLine;
          String newLine = "";
          if (validLine(line))
               newLine = line.substring(3, line.length()).trim();
          return newLine;
     private boolean validLine(String pLine) {
          if (pLine != null && pLine.length() > 3)
               return true;
          else
               return false;

Your 1,000 lines of code were indented so deeply that they scrolled off the right side of my screen and were extremely inconvenient to read. So I didn't read it.
However. Your question claimed to be about XSLT but I didn't see any XSLT posted. That was sort of strange. Anyway, if you are generating character strings containing <BR> then what you see is what you have to expect. If you want a <BR> element then generate a <BR> element. Like the one you see in the XML example you posted. (What was the relevance of that example, anyway? I didn't get that either. Was it supposed to represent the input you hoped that code was generating, or something?)

Similar Messages

  • Problem with HTML viewer

    Dear All ,
    I am facing a problem with HTML Viewer . My senario is as follows :
    1. I have created one HTML page . On that page there are 4 Images
    2. I imported that HTML page in SAP with the help of transaction SMW0
    3. I Called that HTML page in my ABAP program using the method "load_html_document" of class cl_gui_html_viewer
    4. This is happening perfectly ok on the machine on which all this developement was done.
    But the issue is when I execute my ABAP program on a different machine , those Images on that HTML page are not displaying.
    Can you please guide me how to remove that machine dependancy?
    Regards,
    Nikhil

    Hi Nikhil,
    Please check if the image is properly imported properly. Also check if there is any option which you might have forgotten while imported like dependeency.
    Regards
    Abhii...

  • Problems with html content in box

    Hi! I have a problem with html content. For example photoswipe. If I import the folder with the index.html of photoswipe as an article all works fine. If I link it trough the folio overlay creator/webcontent) into a box in indesign dps, it stays empty. Seems like it doesnt find the images/paths??
    Klaus

    This sounds familiar. PhotoSwipe doesn't seem to like working in a web content overlay unless the JavaScript and other source files are uploaded within HTMLResources. This means editing your local HTML file so that paths to the JavaScript, images and CSS files begin by pointing to HTMLResources virtual folder (../../../HTMLResources/) before their subfolder and filenames. It's worth a try.

  • XSLT problem with img tag in Saxon

    Hi,
    Iam getting a problem with <img> tag when transforming a document using Saxon transformer. In the input XSLT I have proper closing tag for <img>, but the output of the transformation is not well formed as the closing tag for <img> does not appear. I need to feed the output to a FO object to generate a print preview, but the output is not well-formed.
    Kindly help to resolve the issue.
    Kind Regards,
    Abhinandan

    Perhaps that is because you are generating HTML as your output? As I recall, <img> tags don't have to be closed in HTML. So try generating XML instead if you need XML.

  • Problem with HTML in a read only textarea item

    I'm working on a messaging system for our site. For the body of the message, we use a standard textarea item. However, if we come to the messaging page from a certain page in our system, then we pre-load the textarea item, and make it read only. The only problem with this is that there are HTML tags in the body that we try to pre-load. This is causing problems because they aren't being interpreted as tags, but are being displayed as text. If I make the textarea editable, then everything looks fine, it's just when I set the area to be read only that it doesn't work. Any thoughts on how to fix this? Thanks!

    Not always. A user is allowed to edit that area in most circumstances except for when the user arrives at the page coming from 1 page in particular. In this case, then the field is read-only. At all other times though, it is editable.
    As a workaround, whenever I know I'm coming from this page, I set a variable, and if the variable is set, then I use a Display Only item and then hide the Textarea. If the variable is not set, then I hide my Display Only item and show the Textarea. Not very elegant, but it works.

  • XSLT-problem with sequence attributes

    Hi,
    in my XSLT-program (i'm a real newbie!) i'm adding dynamically attributes and their values to a tag, by using the following code :
    <SUPPLIER>
      <xsl:attribute name="FUNLOC">
        <xsl:value-of select="SUPPLIER_FUNLOC" />
      </xsl:attribute>
      <xsl:attribute name="NAME">
        <xsl:value-of select="SUPPLIER_NAME" />
      </xsl:attribute>
      <xsl:attribute name="LOCATION">
        <xsl:value-of select="SUPPLIER_LOCATION" />
      </xsl:attribute>
      </SUPPLIER>
    The problem is that the attributes in the resulting xml-file are alphabetically ordered. For instance :
    <SUPPLIER FUNLOC="9522222" LOCATION="NL" NAME="Test vendor VMOI">
    How can i arrange that the result of the xml-file is a sequence of entrance is taken, so
    <SUPPLIER FUNLOC="9522222" NAME="Test vendor VMOI" LOCATION="NL" >
    regards,
    Hans
    [email protected]

    Hi Hans,
    I think you're using ABAP-XSLT?!
    If you do so, you can solve the sorting problem by using a 1:1 Message mapping after the ABAP-XSLT mapping. This resolves the problem that the nodes are not in the correct order.
    In your interface mapping you have to configure 2 mappings:
    1: ABAP-XSLT
    2: Message mapping.
    Of course this means that the total processing time increases a little bit.
    I had the same problem with the sequence of my (ACC_DOCUMENT) idoc nodes, the ABAP-XSLT screwed up the idoc, but the 1:1 message mapping solved the problem.
    Regards,
    Mark

  • Problem with HTML email formatting

    I'm using Firefox 4.0.1. I have a job function that requires me to use web page based email. When responding to emails, Firefox automatically places the cursor at the bottom of the chain as opposed to the top of the chain as in previous versions. I need for the response to start at the top of the page. This is the way it worked in my previous version of Firefox and no settings in the email program have been changed. In fact there is no setting in that program to specify where the response will go. I'm assuming the cursor placement is being determined by Firefox. Please help me change it.

    Oooops forgot the link
    http://www.adlerhealth.com/ad122607/ad122607.htm
    "Ken Binney" <[email protected]> wrote
    in message
    news:fljkp6$9kc$[email protected]..
    > Look at this HTML email.
    > The email message is only about 7.5kb because all it's
    images are on a
    > webserver.
    >
    >
    >
    >
    > "[email protected]" <[email protected]>
    wrote in message
    > news:flj9fg$qrg$[email protected]..
    >> I've made a few email newsletters, but the problem
    that I have is that I
    >> can't
    >> use a lot of images because when the email is sent
    it has a large file
    >> size.
    >> The images themselves are very big files, like under
    10 kb, is there
    >> anyway to
    >> add multiple images to an email while still keeping
    the file size down.
    >> Also I
    >> have a problem with the formatting of the email.
    When the html is placed
    >> into
    >> an email the spacing isn't right, it usually is the
    images that I have
    >> problems
    >> with. If this is any help I make the newsletters out
    of tables. I'd
    >> appreciate any tips you can think of.
    >>
    >
    >

  • Problems with HTML in 11g

    Got 11g up and running without too much difficulty (Win2003) but I'm having trouble getting HTML content to render. For example, create a simple analysis, add a narrative view, check the "Contains HTML Markup" button, and put HTML in there, but it comes out escaped anyway?
    I couldn't find much mention of this in the docs, other than the usual about XSS hardening. I verified that I have the "Save Actions containing embedded HTML" and "Save Content with HTML Markup" privileges - just to make sure, I even granted them to AuthenticatedUsers.
    Any ideas?

    Hi All,
    It seems like this problem is specific to the "Narrative View". If I try the following in the "Static View" it works like expected;
    <hr size="15" width="100%" shade align="right">
    In the "Narrative View" I did not get it to work yet.
    Cheers,
    Daan Bakboord
    http://obibb.wordpress.com

  • JavaHelp: problem with HTML size

    Hi guys,
    I converted a MS Word document to HTML and I'd like to display it using JavaHelp. The HTML file size is about 800k. It does work, but it takes a few minutes to be displayed!!!
    I tried with HTML files with size of about 100k and it works better (it takes a few seconds).
    Where is the problem? Is the HTML size? Or is MS Word that doesn't work so well?
    Thanks a lot for your answers!
    Paul.

    MS Word produces fat ugly HTML.

  • Are ther any Problems with HTML in iOS 6?

    We are having a problem with animated HTML-Objects in Adobe DPS. It's seems to be related with the iOS 6 update. We have two iPads, one with the updated software (iOS 6) and the other without it (iOS 5). Both of these have been updated with the new Adobe Content Viewer. The one with the old iOS works perfectly (HTML, Edge Animation, Videos) but the other with the most-up-to-date software does not. The HTML doesn't play and some times plays it once. We even tried by adding it to the HTMLResource folder to be trigger by a button to open a new window by itself, but no joy. Again we don’t have any of these problems on the iPad without the current software update. They all work perfectly

    All the HTML content on my iOS 6 devices renders fine.
    What does a web page from a non-Adobe DPS site look like?
    From your description, it's a problem with the Adobe software.
    Contact them.

  • Problem with HTML form on Android

    Hello,
    we are experiencing problems with quite simple HTML/Javascript form included in Adobe DPS publication on Android. It's working on iPad without problem, it's working on standard Android Chrome viewer, but when included in DPS publication, we can't write anything in the form.
    Does somebody encountered same problem and found solution? seems that this problem appeared on some newer version of Android, circa 4.3.
    Thanks
    Martin

    Hi, there, a couple of things to double check on your emulator settings:
    When configuring the Android emulator, please make sure the emulator emulates ARM Processor (armeabi - v7).  ADF Mobile only works with ARM processors - both device and emulator.
    Under Memory Options, please ensure RAM is at least 768 or greater.  This of course is also constraint by the amount of memory your development machine has, but generally you should have at least 768 MB allocated.  ADF Mobile app itself won't take up nearly that much RAM of course, but there are a lot of Android apps that are started in the background when Android emulator starts.
    Also, make sure there is 500 MB of internal storage configured - you can go as low as 200 MB but the space will quickly.
    Lastly, before you compile/deploy again, please go to JDeveloper menu item Build - Clean All to clean up any left over deployment artifacts.
    Thanks,
    Joe Huang

  • Problem with html:select or html:options tags using struts,jsp and tomcat

    Hi
    I'm updating a Struts-Project to a new layout and therefore rework all jsp Sites.
    I'm also using a new Folder-Structure and update therefore my struts-config file.
    My Problem now is:
    Till now, we had a select-field with a code like this:
    < html:form action="/timetableAction" method="POST">
    < table width="53%" border="0">
    < tr>
    < td>< html:radio property="dauer" value="semester"
    /></ td>
    < html:select property="semester" size="1">
    < htmlptions name="semesterList" />
    </ html:select>
    </ html:form>
    The problem now is, that whenever I use any <html:xy> tag, the tomcat server I use can not show the page, he shows just the headers of the template, but not the
    content.-jsp-File where the form would be in. He stops right in the middle of the html page, when he notices the <html:xy> tags.
    And the funny thing is, that he has no problem to show a page when there is a <html:errors> within it? Why could this be? the struts-html.tld File is well included and teh Tomcat Server shows no exceptions.
    Waiting for you answers and thanks

    Thank you, I already got the answer in another forum

  • XSLT Problem with soap namespace

    Hi there,
    I have a problem transforming an XML doc with soap elements, using XSLT (Xalan).
    Here's the input:
    <?xml version = "1.0" encoding = "ISO-8859-1"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.ean.nl">
      <testthis>123456</testthis>
    </soap:Envelope>and here's the XSL:
    <?xml version="1.0"?>
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" exclude-result-prefixes="soap">
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="soap:Envelope">
    <Orders>
         <H01>
              <xsl:value-of select="testthis"/>
         </H01>
    </Orders>
    </xsl:template>
    </xsl:transform>I expect to get something like:
    <?xml version="1.0" encoding="UTF-8"?>
    <Orders>
    <H01>123456<H01>
    <Orders>But instead I get:
    <?xml version="1.0" encoding="UTF-8"?>
    <Orders>
    <H01/>
    </Orders>I've tried a lot of things and I'm probably overseeing something stupid, but I'm stuck.
    It seems as if anything without soap: namespace cannot be processed by my XSL (when I add it in the input XML and XSL it works).
    Any help would be greatly appreciated.
    Greetings,
    Erik

    Yes, I found it!
    The following XSL for the same XML doc works!
    <?xml version="1.0"?>
    <xsl:transform xmlns:ean="http://www.ean.nl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" exclude-result-prefixes="soap">
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="soap:Envelope">
    <Orders>
         <H01>
              <xsl:value-of select="ean:testthis"/>
         </H01>
    </Orders>
    </xsl:template>
    </xsl:transform>Thanks, you pointed me in the right direction :-)
    Erik

  • Styling XML with XSLT Problem with javax.xml.transform???

    I have been trying to make a transformation and seem to be having a problem in that javax.xml.transform can not be found while using jdk1.3....If I use jdk1.4, there is no problem....
    Does anyone know how I can get things to work using jdk1.3???
    (Description of what I am doing...1) Building XML Source 2) Setting up the XSLT File 3) Building Source Object 4) Build Result Object 5) Transforming the Data.....MY RESULT SHOULD BE AN HTML PAGE)
    I have tried putting xerces.jar and xalan.jar in my CLASSPATH....but this still doesn't work....onyl thing that has worked is using jdk1.4 as my JAVA_HOME....
    PLEASE HELP!!!!

    PLEASE HELP....your advice here would be greatly appreciated.....

  • Problems with Html in Report in different browsers

    Hi all!
    I4m doin4a Sql query Report with it will be used as a menu with linked option with htp.anchor and in the display html options I use html to create an style that shows the lines in white and not underlined, it works ok, but only in Iexplorer, in Netscape is shows me not underlined, but colored blue
    I4m going insane
    Any help will be appreciated, (better as faster as possible ;P )
    Thks all
    Chema

    Hi All,
    It seems like this problem is specific to the "Narrative View". If I try the following in the "Static View" it works like expected;
    <hr size="15" width="100%" shade align="right">
    In the "Narrative View" I did not get it to work yet.
    Cheers,
    Daan Bakboord
    http://obibb.wordpress.com

Maybe you are looking for

  • How do I stop receiving iMessages across all devices?

    I have multiple apple devices setup to receive iMessages, but I have changed my main phone from iPhone to another phone and would like to stop receiving iMessages from my contacts. How do I disable iMessages from being sent by all of my contacts?

  • Doubt on Syn/Asyn Bridge scenario without BPM

    I followed the how to guide “How To Realize a sync-async and async-sync bridge within the Adapter Framework”,but issue still exists. It’s a File(QoS:BE)<=>Idoc scenario 1 File adapter sends a sync booking request to idoc(MSG type: FLIGHTBOOKING_CREAT

  • Web Services General Question

    Hi All, Does web services in Java mean to simply provide a SOAP container that wraps around an EJB (or even a web container)? If this is true, all of the work that's been done with the development of EJBs can be preserved, and other system will make

  • HT4859 If I have the app turned off for storage in iCloud does this mean the app can not be downloaded to a new device?

    Manage Storage. 1.  What am I deleting specifically when this message appears "Are you sure you want to turn off CNN backups and delete the backup data from the cloud? 2.  If I have the app turned off for storage in iCloud does this mean the app can

  • RFUMSV00 AND COUNTER IN TRVOR

    Hi, I have a problem with report RFUMSV00 (Italy) and table TRVOR. The problem is referred to the counter (field VZAHL) in TRVOR, the field has the right value but the report starts always by 1. There was a similar problem with the page number resolv