XSL:Text img ... Breaks in transformation

Hi
I am sure this is a nobrainer. I am using Java to transform an XML document on the server. What I want to do however is to transform values to a corresponding image on the server. eg Database has value 2 stored. The XSL style sheet then transfroms this to <img src="2">.
I am using the following
<td class="tableText"><xsl:text><img src="</xsl:text><xsl:value-of select="PRICE"/><xsl:text>"></xsl:text>I have tried using the disable-output-escaping flag and it doesn't seem to make much difference. If I substitute < for < then this is treated as text by the browser. I am sure I am being stupid so please stop me going mad.

What you have shown there is not even valid XML, as you are not allowed to have the character < in an attribute. You have to escape it by typing &lt; instead. However, your comments "If I substitute < for < ..." indicate that you probably haven't shown what you actually have, because you don't know how to type the input so that it displays correctly in HTML.
To get a < character, you must type "&lt;". And if you want to see "&lt;" you must type "&amp;lt;".
So try again, and show us what you actually have.

Similar Messages

  • SQL data transformed by XSL-TEXT template

    Hi,
    please, how can I transform data retrived by SQL query using XSL-TEXT template (need to generate text file using rpad/lpad XSL function)? There is no problem if the data set is 'XML file', with setting the data set as SQL querry I'm lost..
    Thanks for all replies.
    Rad

    Hi,
    problem solved by using data template.
    Rad

  • xsl:text not preserving whitespace

    When I try to use <xsl:text> to put spaces into the output of a transform, it does'nt work. Leading/trailing spaces gets stripped and a single space by itself gets dropped altogether.
    This is using the PL/SQL XSLT on an XMLType in 9.0.2.
    If I run the same transform on the same data but using XALAN XSLT it works fine.

    Was that supposed to read:
    <xsl:text>& amp;#xa0;</xsl:text>?
    (I added whitespace so you could see the ampersand, but that's not a non-breaking space, that's an actual printable character.
    I later found a solution that worked in this thread:
    Cannot get to print NEWLINE in XMLTransform using XSLT
    Posted: May 2, 2007 10:16 AM
    Cannot get to print NEWLINE in XMLTransform using XSLT
    Thanks,
    Eric

  • Xsl text output help

    I would like to use an xsl transform to output an xml dom tree as a text file.
    I have tried using <xsl:output method="text" media-type="text/plain"/>
    and I use <xsl:text > to output text but my resulting file only contains the following line:
    <?xml version="1.0" encoding="UTF-8"?>
    Anyone know what I am doing wrong?
    Thank you,
    --Elliot                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    It should work fine. Just check if template matchings are correct. Seems some xslt problem; post your translator and xml file so somebody can help
    Message was edited by:
    winay

  • XSL-TEXT: how to import subtemplates in XSL and use xdofx tags?

    Hi,
    I am working on a BI Publisher Report (XML Publisher 5.6.3 in EBS) to generate labels on a label printer. The output needs to be in plain text format, therefore I decided to use the XSL-TEXT template and create my own XSL translation.
    In principle this works pretty fine, but there are two things that worry me a bit:
    1. Does anybody know how I could import other XSL files, like sub-templates in RTF? The problem I have is that I don't know the URI or the sub-template. At the moment I store those other XSL files in the OA_MEDIA folder, but this is not really nice. In RFT you can refer to subtemplates with some xdofx commands... this brings me to my second question:
    2. In RTF templates you can use the Oracle specific XML tags, including the <xdofx:%> and <xdoxslt:%> tags. Does anybody know if and how I can use them in XSL templates?
    Any ideas are highly appreciated!
    regards,
    David.

    Hi Vetsrini,
    1. but what is the absolute path for my subtemplates if I store them in the Template Manager? How can I refer to them?
    This is what the manual says for RTFs:
    >
    Enter the Import Syntax in the Primary Template
    Import the subtemplate to the primary template by entering the following syntax in the
    primary template. The import syntax tells the XML Publisher engine where to find the
    subtemplate RTF in the Template Manager. This syntax may be entered anywhere in the
    template prior to the call-template syntax:
    <?import:xdo://APPCODE.TEMPLATE_CODE.lang.TERR?>
    where
    APPCODE is the Application code you assigned to the subtemplate in the Template
    Manager. For example, if you associated this template with the Receivables application,
    enter "AR".
    TEMPLATE_CODE is the template Code you assigned to the subtemplate in the Template
    Manager. For example, AR_CommonComponents.
    >
    sounds good and easy to me. But I don't have a RTF template. I have just a plain XSLT and those XML Publisher tags do not work there. So how do I get the absolute path of my XSLT templates stored in the Template Manager?
    2. I've included the namespace, no error anymore. But the syntax does not result in actions:
    <xsl:value-of select="xdoxslt:substr((PRODUCT_NAME),1,2)"/>
    {code}
    This does not substring() my string, the full string is returned. But anyway, I don't get an error message anymore. Maybe I just used the wrong XDOXSLT function... I need to search for a list of XDOXSLT functions, but that's not very urgent for now. I think I can do the most with plain XSL and inside the DB itself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Xsl:text

    xsl:text elements always are shown as errors in xslt. It appears that the dtd being used by JDeveloper is wrong. Can someone at Oracle respond to this and tell me either where a good dtd is, and how to get jdeveloper to recognize it, or when a patch will be available. Incorrectly flagging xsl:text is making the syntax validation within the code editor useless.
    TIA,

    In JDeveloper 10g <xsl:text> gets added.
    Which Jdev version produces xsl:text error?

  • Form XSL Text E-Mail?

    I have been searching online to determine if I can use Adobe Forms for my application. For various reasons related to existing downstream processing, I need a flow as follows:
    - User downloads form from the web.
    - User enters data into a the form offline.
    - User presses "submit" and the form data is sent via the user's e-mail client to a static e-mail address contained in the form definition.
    All of the above seems possible with Adobe Forms. The complication is that I need the form data to arrive at the given e-mail inbox in a specific text format, not in XML. I can write an XSLT Stylesheet to transform the XML into the required text format, and I see that there is some XSL support in the Adobe Forms system. It wasn't clear
    A - where in the process the XSL is applied or
    B - if it is acceptable for the XSL output type to be set to text.
    If push comes to sove, I can apply the XSL downstream, i.e., I can send XML via e-mail and then apply the transformation. Other circumstances I won't describe here make that a PITA and so I'd rather do the transform earlier in the process.
    Thanks in advance for any help or advice.

    When comparing strings, you should use the .equalsMethod.
    You should also check for null in most cases.
    if (escalationType != null && escalationType.equals("Tipo1"))
    // an equivalent but shorter way of doing this...
    if ("Tipo1".equals(escalationType))

  • Proprietary Sys.= XML= XSL-FO= PDF In memory transform

    I am trying to preform an in memory creation of a pdf (using XSL-FO and FOP) from data contained in a proprietary system.
    The process I am using is:
    1: get xml of the data in the proprietary system (this works and the xml is fine)
    2: create the XSL-FO using the xml from stage 1 and an xslt (where I am going wrong)
    3: transform the xml to pdf (this works if I save the XSL-FO.xml and the xslt used to disk and then run FOP seperately)
    When I run the code I get a Fatal Error from FOP - Content not allowed in prolog. When I write the XSL-FO file to disk and look at it, it's not been transformed to XSL-FO and is missing all the mark-up.
    I have put the code below - any help would be very appreciated.
    Thanks
    // Setup XML input - The methods to create the initial xml return a String
    StringReader inSource = new StringReader( inResult );
    // Setup XSLT Stylesheet - The fo styles are stored in the proprietary system
    String foXSL = getStyleSheet("FOStyleSheet");
    ByteArrayOutputStream foXMLba = new ByteArrayOutputStream();
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer( new StreamSource( new StringReader( foXSL ) ) );
    Result foRes = new StreamResult( foXMLba );
    transformer.transform( new StreamSource( inSource), foRes );
    Driver driver = new Driver();
    driver.setRenderer( Driver.RENDER_PDF );
    ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
    driver.setOutputStream( pdfOut );
    driver.setInputSource( new InputSource( in_foResult ) );
    driver.run();

    an xslt (where I am going wrong)Yes, I would say that's a good guess at your problem. It does indeed sound like one of the common XSLT errors, where none of your templates are being matched and the default handling takes over; all that does is to copy the text nodes to the output.
    PC&#178;

  • Xsl:output ignored when doing transformation by XMLReader and XMLFilter

    I want to make XML transformation via XSL file using XMLReader and filter as described in java tutorial http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/5_chain.html, but it is not working correctly. Transformation is not using encoding and method set in xslfile by <xsl:output method="xml" encoding="ISO-8859-2"/>.
    I wrote simple test program whitch has two method doing transformation:
    transform_method1 - transforms by XMLReader and filter
    transform_method2 - transforms in other manner described in the same tutorial
    The second method is working, but first not. Maybe someone has some solution why the first method is not working correctly?
    Here is test class:
    package xslt;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.sax.*;
    import javax.xml.transform.stream.*;
    import java.io.*;
    public class TestTransform {
        public static void main(String[] args) {
            File xml_file = new File(args[0]);
            File xsl_file = new File(args[1]);
            File output_file_method1 = new File(args[2]);
            File output_file_method2 = new File(args[3]);
            transform_method1(xml_file, xsl_file, output_file_method1);
            transform_method2(xml_file, xsl_file, output_file_method2);
        private static void transform_method1(File xml, File xsl, File output) {
            try {
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream(xml));
                InputSource input = new InputSource(bis);
                SAXParserFactory spf = SAXParserFactory.newInstance();
                SAXParser parser = spf.newSAXParser();
                XMLReader reader = parser.getXMLReader();
                SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory.newInstance();
                XMLFilter filter1 = stf.newXMLFilter(new StreamSource(xsl));
                filter1.setParent(reader);
                StreamResult result = new StreamResult(output);
                Transformer transformer = stf.newTransformer();
                SAXSource transformSource = new SAXSource(filter1, input);
                System.out.println("encoding method1="+transformer.getOutputProperty(OutputKeys.ENCODING));
                transformer.transform(transformSource, result);
            } catch (Exception e) {
                e.printStackTrace();
        private static void transform_method2(File xml, File xsl, File output) {
            try {
                TransformerFactory tFactory =   TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer( new StreamSource( xsl) );
                System.out.println("encoding method2="+transformer.getOutputProperty(OutputKeys.ENCODING));
                transformer.transform(new StreamSource(xml), new StreamResult(output));
            } catch (Exception e) {
                e.printStackTrace();
    }and here is test xml file:
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <root>
        <line>Some text line 1</line>
        <line>Some text line 2</line>
        <line>Some text line 3</line>
    </root>the test stylesheet:
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="ISO-8859-2"/>
    <xsl:template match="root">
         <p><xsl:apply-templates/></p>
    </xsl:template>
    <xsl:template match="line">
         <div><xsl:apply-templates/></div>
    </xsl:template>
    </xsl:stylesheet>I get output file from method1:
    <?xml version="1.0" encoding="UTF-8"?>
        Some text line 1
        Some text line 2
        Some text line 3and method2 output:
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <p>
        <div>Some text line 1</div>
        <div>Some text line 2</div>
        <div>Some text line 3</div>
    </p>Output on System.out from program is:
    encoding method1=UTF-8
    encoding method2=ISO-8859-2Can someone help how can I make transformation like transform_method1 style not to ignore <xsl:output method="xml" encoding="ISO-8859-2"/> tag?

    You have two transformations chained together. The first is the XMLFilter, which uses your XSLT, and the second is the Transformer, which takes its output and does an identity transformation on it. The second transformation is the one that produces your final XML, so it's the one that controls what encoding it gets.
    So your stylesheet should be working. Your only "problem" is that you get a different encoding than you expected. And I put "problem" in quotes because the output you are getting is identical, in XML terms, to the output you want to get.

  • How to pass parameters to an XSL for use in a transform (JSP/XSLT)?

    I have an XSL: style.xsl
    I have an XML: data.xml
    I want to do an XSL Transform on data.xml, using style.xsl, with parameter
    Language=en
    With Saxon you would do:
    saxon data.xml style.xsl Language=en
    But how would I do this with WL6.x, using the JSP XSLT tag:
    <x:xslt [xml="uri of XML file"]
    [media="media type to determine stylesheet"]
    [stylesheet="uri of stylesheet"]
    <x:xml>In-line XML goes here
    </x:xml>
    <x:stylesheet [media="media type to determine stylesheet"]
    [uri="uri of stylesheet"]
    </x:stylesheet>
    </x:xslt>
    Thanks
    Alain Jacquot

    There is currently no way to do this from the jsp xslt tag. I have filed an
    issue because this is available in the JAXP 1.1 API. If you need this
    functionality in the current version you will need to use the JAXP API
    directly.
    Sam
    "Alain Jacquot" <[email protected]> wrote in message
    news:3b368016$[email protected]..
    I have an XSL: style.xsl
    I have an XML: data.xml
    I want to do an XSL Transform on data.xml, using style.xsl, with parameter
    Language=en
    With Saxon you would do:
    saxon data.xml style.xsl Language=en
    But how would I do this with WL6.x, using the JSP XSLT tag:
    <x:xslt [xml="uri of XML file"]
    [media="media type to determine stylesheet"]
    [stylesheet="uri of stylesheet"]
    <x:xml>In-line XML goes here
    </x:xml>
    <x:stylesheet [media="media type to determine stylesheet"]
    [uri="uri of stylesheet"]
    </x:stylesheet>
    </x:xslt>
    Thanks
    Alain Jacquot

  • XSL problem with javax.xml.transform.sax.SAXTransformerFactory

    Dear sirs,
    I use SAXTransformerFactory in order to transform a Hashtable to SAX Event and apply a XSL.
    I try this code with the lastest version of apache parser.
    It run well.
    But, I put this software to WEBLOGIC 6.2 server and no run.
    this check is true:
              if (transFact.getFeature(javax.xml.transform.sax.SAXTransformerFactory.FEATURE)&&transFact.getFeature(javax.xml.transform.sax.SAXSource.FEATURE))
    Some one can help me.
    Thank in avance
    The code:
    java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
              com.cajarural.xml.HashtableParser parser = new com.cajarural.xml.HashtableParser(hashtable);
              // Codigo para el TansformerHandler
              // set the destination for the XSLT transformation
                   javax.xml.transform.TransformerFactory transFact = javax.xml.transform.TransformerFactory.newInstance();
                   if (transFact.getFeature(javax.xml.transform.sax.SAXTransformerFactory.FEATURE)&&transFact.getFeature(javax.xml.transform.sax.SAXSource.FEATURE))
    javax.xml.transform.sax.SAXTransformerFactory saxTransFact = (javax.xml.transform.sax.SAXTransformerFactory) transFact;
    javax.xml.transform.sax.TransformerHandler transHand = saxTransFact.newTransformerHandler(templates);
    transHand.setResult(new javax.xml.transform.stream.StreamResult(bout));
    parser.setContentHandler(transHand);
    // attach the XSLT processor to the           parser.parse();
              return new String(bout.toByteArray());

    put Xalan in your war file then try using this kind of commands:     System.setProperty("org.xml.sax.parser", "org.apache.xerces.parsers.SAXParser");
    System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl");This tells JAXP what implementations it should use without even asking your administrator to modify the WebLogic setup...
    It's what I've done with the WLS7.0 server I am using ;-)

  • Problem in formatting of long text -- line break not recognized.

    Hi ,
    We have a PO smartform in our SRM system and we are facing problem with formatting of long text on the smartform for long texts maintained for the PO.
    for ex, we maintain the long text as --
    "this is long text for item 1.
    1. this is line 1.
    2. this is line 2."
    On the smartform it is displayed as --
    this is long text for item 1. 1. this is line 1. 2. this is line 2.
    So basically, the line breaks in the text are not considered in the smartform .
    Any suggestions on how to fix this issue ??
    Thanks.

    Hello Harmeet,
    Which Std. FM are you using to fetch the PO texts? If the PO doesn't exist in your system, i'm afraid you cannot use Include Texts as mentioned by Harsh.
    As an alternative you'll have to create a table & pass the text lines to it! I don't think SmartForms are not smart enough to identify new-line character.
    BR,
    Suhas

  • XSL text output problem

    Hi:
    I was trying to output a text from a XSL with XML file, It seems that it spits out all the values from xml file inbetween all the element tags. But all I really need is just a small chunk of it. Does any one know how to get rid of the extra stuff from the generated text?
    Thanks

    Cross-posted: http://forum.java.sun.com/thread.jsp?thread=419800&forum=33&message=1860339

  • Simple dynamic text line break question

    I have a simple file that loads text dynamically inside a symbol.. How do I put line breaks in? My code is below. If I leave the text as is it skips a line inbetween.
    (actionscript in flash file)
    loadVariables("pacific.txt", "_root.pacific");
    txt file
    data=CANADIAN PACIFIC DISTRICT
    Steve Foster
    [email protected]
    1-877-850-2664
    Cell: 250-667-4827
    thanks,
    Frank

    NOT
    /n
    use:
    \n

  • CS5: Type tool entering text in a tiny transform box

    Everything else seems to be working correctly (at least those parts I use).
    At some point, several months ago, my sister and I were playing with transform (by phone, we are in different states) -- she had taken a Photoshop class and wanted to try to duplicate something.
    I tried using my type tool yesterday, and couldn't see anything when I typed. (White background, black text, Arial, 14 pt, 100%)
    I've tried clearing type presets.
    I finally tried blowing it up to 500% and saw a small, gray font-like image where I was typing.
    I held down Ctrl and played with the transform box: if I expanded the box, my text is there.
    I've tried clicking on everything at the top when in transform, but have no idea what I'm doing.
    I have no idea how to get my type tool entering text in the regular way.
    Please help.
    Thanks!

    The resolution of the file I was working on was 2 (I obviously didn't add or deleted the '7' that was supposed to be in front of it)!
    Thank you ever so much, CB! I spent a couple hours on this and really appreciate your help and insight.

Maybe you are looking for