Unused xml tags being printed in xsl transformation

Hi,
I'm just starting out with xslt, and I am have a small problem with unused data being added into the html output from an xsl transformation. The data set is very small and the transdorm is not complicated, but when I do a
<xsl:template match="aa/bb/cc">
<title><xsl:value-of select"."/></title>
</xsl:template>
cc will be used as the title, but aa/bb/dd and aa/bb/ee will be printed to the output stream directly after the </title> as standard text.
<title>cc</title>ddee
I have include the xml, the transform and the html source recieved at the end of this mail.
Any help would be appreciated.
Cheers
Simon
<webpage>
  <project>
    <title>Katrin</title>
    <version>Version 1.0</version>
    <start_date>01/01/2003</start_date>
  </project>
</webpage>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:output method="html"/>
    <!-- template rule matching source root element -->
    <xsl:template match="/">
        <html>
            <head>
                <xsl:apply-templates mode="head"/>
            </head>
            <!-- Construct main body of page -->
            <body>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>
    <!-- Head -->
    <xsl:template match="webpage/project/title" mode="head">
        <title><xsl:value-of select="."/></title>
    </xsl:template>
    <!-- Body -->
    <xsl:template match="webpage/project/title">
        <h1><xsl:value-of select="."/></h1>
    </xsl:template>
    <xsl:template match="webpage/project/version">
        <div align="right" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : red"><xsl:value-of select="."/></div>
    </xsl:template>
    <xsl:template match="webpage/project/start_date">
        <div align="left" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : blue"><xsl:value-of select="."/></div>
    </xsl:template>
</xsl:stylesheet>
<html xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <head>
      <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Katrin</title>Version 0.101/01/2003</head>
   <body>
      <h1>Katrin</h1>
      <div align="right" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : red">Version 0.1</div>
      <div align="left" style="font-size : 8pt; font-family : Times serif; padding-top : 4; padding-bottom : 4; color : blue">01/01/2003</div>
   </body>
</html>

You had a couple of errors in your xsl. It should read something like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>
<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>
<xsl:template match="*|/">
<html>
<head><title>Greeting</title></head>
<body>Words of greeting:
<b><i><u><xsl:value-of select="greeting"/></u></i></b>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
This produces the result you are looking for:
<html>
<head>
<title>Greeting</title>
</head>
<body>Words of greeting:
<br>
<b>
<i>
<u>Hello World.</u>
</i>
</b>
</body>
</html>
null

Similar Messages

  • Unused XML Tags in InDesign CS2.....

    Hi all,
    Using Javascript i need to generate a report for all unused XML Tags in InDesign CS2.
    Please help it is very urgent...
    Thanks in advance...
    Regards
    Subha

    Hi,
    John Hawkinson thank you so much your suggestion.
    I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
    I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
    Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
    I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
    Thank you John again i am new in this industry please guide.
    snegig

  • Error: "... is not a table ..." XML not correctly interpreted after XSL-transformation. Table row quantity problem.

    Hey guys, this is one of my xml-elements:
    Jaspreet Sohi 12 18 Juliane Lenz 11 17 Sophie Charlotte Stender 10 15 Rosbeh Hamidzadeh Khayyat 12 17 Lion Stoldt 12 17 Mats Lucas Meincke 6 8 Bero Luke Vincent Ernst 6 8 Cedric Roth 6 8 Soner Cantay 6 8 The following XSL Transformation I use once for transforming all "m" tags and once in order to transform all "j" tags. Please imagine the CSL-code below to be duplicated exactly. Only the "jungs"-table-Tag is replaced by "mädchen" and all underscores _j are replace by _m. As well all "select="j[@..." parts are replaced by "select="m[@...". 1 2 3 The code is very easygoing I think and not difficult to understand. As I said, I use it twice - for both transformations. The very, extremely weird thing, my problem, is that one transformation works perfectly in InDesign and a table is created for all "kategorie"-tags (all is set within a for-each loop). But the second script does not work! I simply do not get this I can't understand it. I've tried more than anything. InDesign sais (in German, so translated based on assumption) "jungs is an invalid table element or is displayed in wrong order". The second strange thing is that I can replace my "aid:trows" attribute by any number, e.g. "10" and immediately the script works fine (as there are never more than 6 "j" tags in my XML so that never the table has more than 6 rows"). But it does not want to work correctly with the actual number, my variable "rows_j". These are my variables: They are all defined before the tables for m and j are created. So finally, why (the heck) is one table created and interpreted perfectly whereas the second - immediately following the first in the XSL.script as an EXACT copy of the first - results in an error? As i've already said, I've tried really everything. For example the script works also when one of the parts "" is randomly deleted from the script. Removing one of these parts directly makes the script working. Just one of my attempts to understand the thing but this has only shown that none of these parts "cell to end-for-each" includes an error. I'm really desperate and looking forward to being rescued by one of you geniuses :)

    Hah, No worries. The forum software is, well, different.
    What would be better, though, would be a sample ID file, any XSLT/XLT files you use, and a bit of data exactly as you have it (pre-transform state). ZIP it up, upload to say dropbox.com and feel free to send me a private message for the download link.
    Too many times there is something different between samples pasted into a post and the real thing that it is sometimes less useful time-wise. I'll keep it private, of course. Then we can communicate via PMs or email until we can (hopefully) arrive together at a solution, then post what that solution is in the forum to benefit others.
    Thank you, Mike

  • Tags not printed when outputting XML after XSLT transformation

    Hi!
    I want my to perform an XSLT transformation on requests to my web service.
    This is the style of a typical request:
    <app:aRequest xmlns:app="http://myNamespace">
      <app:firstTag>value1</app:firstTag>
      <app:secondTag>value2</app:secondTag>
      <app:thirdTag>value3</app:thirdTag>
    </app:aRequest>I want to transform it into something like this:
    <app:aRequest xmlns:app="http://myNamespace">
      <app:firstTag>A hard coded, completely different value!</app:firstTag>
      <app:secondTag>value2</app:secondTag>
      <app:thirdTag>value3</app:thirdTag>
    </app:aRequest>To do that, I use the following XSLT:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:app="http://myNamespace">
    <xsl:template match="/">
    <app:aRequest>
      <app:firstTag>A hard coded, completely different value!</app:firstTag>
      <app:secondTag><xsl:value-of select="app:aRequest/app:secondTag" /></app:secondTag>
      <app:thirdTag><xsl:value-of select="app:aRequest/app:thirdTag" /></app:thirdTag>
    </app:aRequest>
    </xsl:template>
    </xsl:stylesheet>And I use the following code to execute the transformation:
    public Object unmarshal(Source source) throws XmlMappingException, IOException {
      TransformerFactory factory = TransformerFactory.newInstance();
        // Does this factory support SAX features?
        if(factory.getFeature(SAXSource.FEATURE)) {
          SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory)factory;
        // Read xslt file.
        InputStream inputStream = getClass().getResourceAsStream("/META-INF/xsltTransformation.xsl");
        if(inputStream == null) {
          throw new RuntimeException("No XSLT transformation file present at " + location);
        Templates xsltOutputTemplate = saxTransformerFactory.newTemplates(new StreamSource(inputStream));
        Transformer transformer = xsltTemplate.newTransformer();
        // Perform transformation.
        StringWriter stringWriter = new StringWriter();
        StreamResult result = new StreamResult(stringWriter);
        transformer.transform(source, result);
        // Print result.
        String xmlString = stringWriter.toString();
        System.out.println(xmlString);
        // Proceed with unmarshalling.
        StringReader stringReader = new StringReader(xmlString);
        StreamSource transformedSource = new StreamSource(stringReader);
        return oxMapper.getUnmarshaller().unmarshal(transformedSource);
    }However, the System.out.println(xmlString); produces the following result:
    <?xml version="1.0" encoding="UTF-8"?>
      value1
      value2
      value3The tags are not printed and the hard coded value is not present.
    What am I doing wrong? Please help!

    Following up on what the good Dr said,
    Are you sure that you are using the stylesheet that you think you are?
    I tried your stylesheet and input and got more or less what you wanted and not what you actually got.
    Note that I did not use your code.

  • Javax.xml.transform.TransformerException durin XSL Transformation in Java

    Hi,
    Below is my piece of code where i access a web service that returns a xml as a string. I apply a xsl tranformation on it and try to store the result as a string. I get this error message
    javax.xml.transform.TransformerException: Result object passed to ''{0}'' is invalid.
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(Unknown Source)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
         at NewService.main(NewService.java:52)My Code:
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.StringReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.rmi.RemoteException;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.ServiceException;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    public class NewService {
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              String endPoint = "http://localhost:8080/SampleDynamicWebProj/services/SampleClient";
              Service service = new Service();
              Call callOne;
              try {
                   callOne = (Call) service.createCall();
                   callOne.setTargetEndpointAddress(new URL(endPoint));
                   callOne.setOperationName(new QName("http://DefaultNamespace",
                             "getXMLString"));
                   String concated = (String) callOne.invoke(new Object[] { "s" });
                   InputStream xsltFile = new FileInputStream("xslpackage/empTran.xsl");
                   Source xmlSource = new StreamSource(new StringReader(concated));
                 Source xsltSource = new StreamSource(xsltFile);
                 TransformerFactory transFact =
                    TransformerFactory.newInstance();
                 Transformer trans = transFact.newTransformer(xsltSource);
                 Result result = new StreamResult();
                 trans.transform(xmlSource, result);
                 System.out.println(result.toString());
              } catch (ServiceException e) {
                   e.printStackTrace();
              } catch (MalformedURLException e) {
                   e.printStackTrace();
              } catch (RemoteException e) {
                   e.printStackTrace();
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (TransformerConfigurationException e) {
                   e.printStackTrace();
              } catch (TransformerException e) {
                   e.printStackTrace();
    }I get the transformed XML into a Result object, but when i do a toString() oon it, i get the above exception.
    any help wil be appreciated,
    Dilip

    Oh well, yes it was a typo in address tag...ok agreed that its a bad example, check this out then,
    i have a XML data that i convert to a html format using xsl transformation, now this converted html has to be shown in a html page(i use the out.write option).
    so my initial xml looks like this ::
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Results>
        <ColumnCount>6</ColumnCount>
        <Columns>
            <column>UID</column>
            <column>UserName</column>
            <column>Password</column>
            <column>LastName</column>
            <column>FirstName</column>
            <column>EmailAddress</column>
        </Columns>
        <Rows>
            <Row>
                <value>1</value>
                <value>userone</value>
                <value>password-1</value>
                <value>Anant</value>
                <value>Dilip</value>
                <value>[email protected]</value>
            </Row>
            <Row>
                <value>2</value>
                <value>usertwo</value>
                <value>password-2</value>
                <value>Palli</value>
                <value>Gilli</value>
                <value>[email protected]</value>
            </Row>
        </Rows>I apply XSL transformation on this to get a HTML which i will be writing into my output screen hoping that the user will see it in a tabular format!
    <[!CDATA["
    <?xml version="1.0" encoding="UTF-8"?>
    <table border="1">
    <tr bgcolor="#9acd32">
    <th align="left">UID</th>
    <th align="left">UserName</th>
    <th align="left">Password</th>
    <th align="left">LastName</th>
    <th align="left">FirstName</th>
    <th align="left">EmailAddress</th>
    </tr>
    <tr>
    <td>1</td>
    <td>userone</td>
    <td>password-1</td>
    <td>Anant</td>
    <td>Dilip</td>
    <td>[email protected]</td>
    </tr>
    <tr>
    <td>2</td>
    <td>usertwo</td>
    <td>password-2</td>
    <td>Palli</td>
    <td>Gilli</td>
    <td>[email protected]</td>
    </tr>
    </table>
    "]]>The entire data is passed to a XML parser . I want the transformed xml data (which will be inside a <status></status> tag to be untouched by this parser. As you see i have put the transformed xml in a CDATA tag, but this aint helping me...
    need urgent help,
    Dilip

  • Creating an XML From a Deep Structure  using XSL Transformation

    Hi ABAPers,
    I have a requirement to use XSL Transformations on an ABAP deep type structure.
    Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT
    in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...
    Am i going in right track or is there a good solution...
    My sample transformation is as below...
    <xsl:transform version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
    <xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/>
    <xsl:value-of select="VALUES/DATA/NODE_ID"/>.
    </xsl:template>
    </xsl:transform>
    Please help me in solving this issue....
    Thanks,
    Linda.

    Hi Linda,
        I am replying based on your sample code.
       Try the below following suggestions.
       here 'GRPHDR' is the node where I am selecting the data.
               IGRPHDR is the name of the reference.
    First calling the transformation in you program.
    TYPES: BEGIN OF tl_hdr,
               msgid(20)    TYPE c,
                 END OF tl_hdr.
    DATA : t_hdr           TYPE STANDARD TABLE OF tl_hdr.
      GET REFERENCE OF t_hdr INTO l_result_xml-value.
        l_result_xml-name = 'IGRPHDR'.
        APPEND l_result_xml TO t_result_xml.
       TRY.
            CALL TRANSFORMATION yfi_xml_read
            SOURCE XML it_xml_data
            RESULT (t_result_xml).
          CATCH cx_root INTO l_rif_ex.
            l_var_text = l_rif_ex->get_text( ).
            l_bapiret-type = 'E'.
            l_bapiret-message = l_var_text.
            APPEND l_bapiret TO errormsgs.
            EXIT.
        ENDTRY.
    in XSL transformation
       First write a block of statement to specify from which node you are taking the data.
       No matter it is a node or sub-node.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
    <xsl:template match="/">
          <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IGRPHDR>  " reference name of internal table
              <xsl:apply-templates select="//GrpHdr"/>
            </IGRPHDR>
      </asx:values>
        </asx:abap>
    </xsl:template>
    Next select the data from the nodes under the nodes specified in the transformation.
    here msgid is the field i am selecting for value.
    <xsl:template match="GrpHdr">
        <item>
          <MSGID>  " field in the internal table t_hdr where data has to go
            <xsl:value-of select="MsgId"/>
          </MSGID>
        </item>
      </xsl:template>
    reply back if further clarification is needed.
    Thanks and regards,
    Kannan N

  • XML Tag in PHP Not Printing

    Hello Guys,
    I am using PHP 5 version and trying to print simple xml tag but its not wotking. The tag is echo '<markers/>'; . If i remove '>' i,e echo '<markers/'; its working fine. What could be the reason ?
    Thanks,

    Reason is quite simple. If your output does not start with <?xml ...?> (it probably does not) then browser undrstands and interprets it as HTML tag. So if you use "view page source" your tag will there.

  • How can i exclude information pages from being printed in a dynamic XML form?

    Hi there,
    i am building a dynamic XML form in Adobe LiveCycle Designer ES2.
    In this form there are pages with information that help the end user fill out the form, but to use - those who process the forms after they have been sent to us - these pages with information are irrelevant.
    Is there a way to tell the form to omit these pages when printing.
    Currently i have set the pages mentioned to be only visable on-screen.  But doing so results in an empty page being printed (only the master page information is visable.)
    Any ideas how i can solve this issue?
    Thank you.

    Create a new master page and set that page to visible screen only. Set your subforms to use that master.

  • How do we stop the XSL transform creating an empty tag when there is no inp

    Here is a way to stop the XSL transform from creating an empty tag when there is no input.
    1. Open the XSL Map in Jdev
    2. Go to the Design Tab
    3. Right click the tag in the target tree and select "Add XSL node -> xsl:if"
    4. Create a new link from the source tag (the same that is linked to the target tag) to the newly created xsl:if

    For anyone coming in to find this, I located my answer here:
    [Special Applet Attributes|http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/special_attributes.html#codebase]
    Thanks for reading.
    Sorry for the interruption.

  • Print thru XSL or XML

    Hi all
    i am struggling to take the print in webdynpro SO for,
    i have tried the following code using your valuable help
    Pls Guide me futher more.Nobody giving correct solution so for i.e Step by Step from the beginning itself
    pls help us in this regarding
    ****The following code is the XSL Template
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template match="/">
    <html>
    <head>
    <title></title>
    <script language ="javascript">
    function prin()
                document.frm.jd.src="C:/emp.jpg";
                javascript:print();
    </script>
    </head>
    <body>
    <form name="frm">
    *********************Header Part Start
    <table bgcolor="" cellpadding="10">
    <tr><th align="left"><font color="#A52A2A">Name</font></th>
    <th align="left"><font color="#A52A2A">Address1</font></th>
    <th align="left"><font color="#A52A2A">Address2</font></th>
    <th align="left"><font color="#A52A2A">State</font></th>
    <th align="left"><font color="#A52A2A">Phone</font></th></tr>
    <hr/>
    ********Header Part End
    <xsl:for-each select="Dhina/Customer-Details">
    ***************Details Part Start
    <tr>
       <td><font color="blue"><xsl:value-of select="CusName"/></font></td>
       <td><font color="blue"><xsl:value-of select="CusAdd1"/></font></td>
       <td><font color="blue"><xsl:value-of select="CusAdd2"/></font></td>
       <td><font color="blue"><xsl:value-of select="CusState"/></font></td>
       <td><font color="blue"><xsl:value-of select="phoneno"/></font></td>
    </tr>
    ***************Details Part End
    </xsl:for-each >
    </table>
    <img src="C:/PRINT13.ICO" name="jd" onclick="prin)"></img>
    </form>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    First Page as usual Header part will print
    I want to print the Header part details in the next page when the no of pages goes to more than one when we click the print button from The IFRAME UI Element.
    Under the Header part, Details part should print like in MSword or Crystal report
    ************The following part in XML
    <?xml version='1.0' ?><?xml-stylesheet type='text/xsl' href='Sample.xsl' ?><Dhina><Customer-Details><CusName>Dhina</CusName><CusAdd1>Add1</CusAdd1><CusAdd2>Add2</CusAdd2><CusState>TamilNadu</CusState><phoneno>99999</phoneno></Customer-Details><Customer-Details><CusName>Karan</CusName><CusAdd1>Add3</CusAdd1><CusAdd2>Add4</CusAdd2><CusState>TamilNadu</CusState><phoneno>11111</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details></Dhina>
    *************End
    Pls Guide us how to control the Header and footer part in the IFrame and also can we control the
    Page skip thru XSL
    We have attached the Report Screen also
    Pls reply as soon as possible
    Regards
    Dhinakar

    Dear Satyajit
    *********************My Xml Start
    <?xml version='1.0' ?><?xml-stylesheet type='text/xsl' href='Sample.xsl' ?><Dhina><Customer-Details><CusName>Dhina</CusName><CusAdd1>Add1</CusAdd1><CusAdd2>Add2</CusAdd2><CusState>TamilNadu</CusState><phoneno>99999</phoneno></Customer-Details><Customer-Details><CusName>Karan</CusName><CusAdd1>Add3</CusAdd1><CusAdd2>Add4</CusAdd2><CusState>TamilNadu</CusState><phoneno>11111</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details><Customer-Details><CusName>Karthi Keyan</CusName><CusAdd1>Add5</CusAdd1><CusAdd2>Add6</CusAdd2><CusState>Karnataka</CusState><phoneno>22222</phoneno></Customer-Details></Dhina>
    *********************End
    i have send already XSL part
    This xml source is created from webdynpro,
    Depending on Select Query(SQL) the source may vary.
    why and where we need to repeat the <div> in my HTML part
    Regards
    Dhinakar

  • Create xml tag dynamically within simple transformation

    Hi all together,
    I'm faceing the following problem:
    There is a internal table provided, consisting of name/value-pairs. Something like
    ls_struc-name = 'NAME1'.
    ls_struc-value = 'XYZ'.
    append ls_struc to lt_struc
    ls_struc-name = 'CITY1'.
    ls_struc-value = 'Munich'.
    append ls_struc to lt_struc
    and so on.
    I have to create this XML (with simple transformation):
    <NAME1>XYZ</NAME1>
    <CITY1>Munich</CITY1>
    Everythings works fine so far (tables, values etc.), but I have problems with creating the XML-Tag, e.g <NAME1> from "$line.name" within the transformation. I don't have any information about the data structure (therefore "call transaction id" does not work).
    Any hint is useful!!!
    Best regards,
    Thomas

    Exaple program for creating XML file from abap
    REPORT  z_xit_xml_dom_create.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
             END OF xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_ostream         TYPE REF TO if_ixml_ostream,
            l_renderer        TYPE REF TO if_ixml_renderer,
            l_document        TYPE REF TO if_ixml_document.
      DATA: l_element_flights TYPE REF TO if_ixml_element,
            l_element_airline TYPE REF TO if_ixml_element,
            l_element_flight  TYPE REF TO if_ixml_element,
            l_element_from    TYPE REF TO if_ixml_element,
            l_element_to      TYPE REF TO if_ixml_element,
            l_element_dummy   TYPE REF TO if_ixml_element,
            l_value           TYPE string.
      DATA: l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i.
      DATA: lt_spfli          TYPE TABLE OF spfli.
      DATA: l_spfli           TYPE spfli.
      START-OF-SELECTION.
    *   Fill the internal table
        SELECT * FROM spfli INTO TABLE lt_spfli.
    *   Sort internal table
        SORT lt_spfli BY carrid.
    *   Start filling xml dom object from internal table
        LOOP AT lt_spfli INTO l_spfli.
          AT FIRST.
    *       Creating a ixml factory
            l_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
            l_document = l_ixml->create_document( ).
    *       Fill root node with value flights
            l_element_flights  = l_document->create_simple_element(
                        name = 'flights'
                        parent = l_document ).
          ENDAT.
          AT NEW carrid.
    *       Create element 'airline' as child of 'flights'
            l_element_airline  = l_document->create_simple_element(
                        name = 'airline'
                        parent = l_element_flights  ).
    *       Create attribute 'code' of node 'airline'
            l_value = l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
    *       Create attribute 'name' of node 'airline'
            SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
          ENDAT.
          AT NEW connid.
    *       Create element 'flight' as child of 'airline'
            l_element_flight  = l_document->create_simple_element(
                        name = 'flight'
                        parent = l_element_airline  ).
    *       Create attribute 'number' of node 'flight'
            l_value = l_spfli-connid.
            l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
          ENDAT.
    *     Create element 'from' as child of 'flight'
          CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
          l_element_from  = l_document->create_simple_element(
                      name = 'from'
                      value = l_value
                      parent = l_element_flight  ).
    *     Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpfrom.
          l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
    *     Create element 'to' as child of 'flight'
          CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
          l_element_to  = l_document->create_simple_element(
                      name = 'to'
                      value = l_value
                      parent = l_element_flight  ).
    *     Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpto.
          l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
    *     Create element 'departure' as child of 'flight'
          l_value = l_spfli-deptime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'departure'
                      value = l_value
                      parent = l_element_flight ).
    *     Create element 'arrival' as child of 'flight'
          l_value = l_spfli-arrtime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'arrival'
                      value = l_value
                      parent = l_element_flight ).
    *     Create element 'type' as child of 'flight'
          CASE l_spfli-fltype.
            WHEN 'X'.
              l_value = 'Charter'.
            WHEN OTHERS.
              l_value = 'Scheduled'.
          ENDCASE.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'type'
                      value = l_value
                      parent = l_element_flight ).
        ENDLOOP.
        IF sy-subrc NE 0.
          MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
        ENDIF.
    *   Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
    *   Connect internal XML table to stream factory
        l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
    *   Rendering the document
        l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                              document = l_document ).
        l_rc = l_renderer->render( ).
    *   Saving the XML document
        l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xml'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.

  • Output to the printer printing xml tags with actual output

    Hi,
    we are calling fnd_request.submit_request with 'XDOREPPB' and assigning a printer to it.
    the output that is getting printed has both the xml tags and the actual output.
    anyone has any idea what might be the reason.
    Regards,

    Got the solution. These tags are getting generated from standard report and we can use <columnname>[1], <columnname>[2]... etc if there are multiple tags with same tag names.

  • Print value of a XML tag

    Hi
    We have a requirement where we need print a value from XML tag. The tag is ike this
    <Order ordernumb=22><Order>
    how can i access the value 22, print it in logs.
    Any functions avaialble for this?
    Thanks
    Kedar

    thanks

  • XML TO PDF printing

    Hi,
    I managed to create a pdf File, from a XML document, using XSLT and XSL-FO.
    I'd like now to print this pdf File from my Java application. Is there a simple way of doing this ?
    Thank you in advance for any help.
    import java.io.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.sax.*;
    import org.apache.avalon.framework.*;
    import org.apache.avalon.framework.logger.*;
    import org.apache.fop.apps.*;
    * This class converts an XML file to PDF using JAXP (XSLT) and FOP (XSL-FO).
    * @author
    public class XmlToPdf {
    private static final String BASE_DIR = "./test/";
    private static final String FILE = "test";
    * Converts an XML file to a PDF file using JAXP and FOP.
    * @param xmlFile The XML file
    * @param xslFile The XSLT stylesheet file
    * @param pdfFile The output PDF file
    * @throws IOException In case of an I/O problem
    * @throws FOPException In case of a FOP problem
    * @throws TransformerException In case of a XSL transformation problem
    public void convertXML2PDF(File xmlFile, File xsltFile, File pdfFile)
    throws IOException, FOPException, TransformerException {
    //Construct driver
    Driver driver = new Driver();
    //Setup logger
    Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
    driver.setLogger(logger);
    //Setup Renderer (output format)
    driver.setRenderer(Driver.RENDER_PDF);
    //Setup output
    OutputStream out = new FileOutputStream(pdfFile);
    out = new BufferedOutputStream(out);
    try {
    driver.setOutputStream(out);
    //Setup XSLT
    TransformerFactory myFactory = TransformerFactory.newInstance();
    Transformer myTransformer = myFactory.newTransformer(new StreamSource(xsltFile));
    //Setup input for XSLT transformation
    Source src = new StreamSource(xmlFile);
    //The generated FO (resulting SAX events) must be sent to FOP
    Result res = new SAXResult(driver.getContentHandler());
    //Start XSLT transformation and FOP processing
    myTransformer.transform(src, res);
    } finally {
    out.flush();
    out.close();
    * Main method.
    * @param args command-line arguments
    public static void main(String[] args) {
    try {
    System.out.println("Starting XML TO PDF Transformation...\n");
    //Base Directory...
    File baseDir = new File(BASE_DIR);
    //Input and output files...
    File xmlFile = new File(baseDir, FILE+".xml");
    File xsltFile = new File(baseDir, FILE+".xsl");
    File pdfFile = new File(baseDir, FILE+".pdf");
    System.out.println("Input: XML (" + xmlFile + ")");
    System.out.println("XSL Stylesheet: " + xsltFile);
    System.out.println("Output: PDF (" + pdfFile + ")");
    System.out.println();
    System.out.println("Transforming...");
    XmlToPdf app = new XmlToPdf();
    // Do the transformation...
    app.convertXML2PDF(xmlFile, xsltFile, pdfFile);
    System.out.println();
    System.out.println("The pdf was created succesfully !\n");
    } catch (Exception e) {
    System.err.println(e.getMessage());
    e.printStackTrace();
    System.exit(-1);

    hi everybody
    i use the code of the class XmlToPdf but i have a problem when i run it
    [ERROR] Unsupported element encountered: html (Namespace: default). Source context: unavailable
    [ERROR] Expected XSL-FO (root, page-sequence, etc.), SVG (svg, rect, etc.) or elements from another supported language.
    java.lang.NullPointerException
    javax.xml.transform.TransformerException: java.lang.NullPointerException
         at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:638)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
         at com.clear2pay.toolbox.reports.fop.XmlToPdf .convertXML2PDF(XmlToPdf java:526)
         at com.clear2pay.toolbox.reports.fop.XmlToPdf .main(XmlToPdf .java:557)
    i don't see where is the problem.
    this is the XML File that i use
    <?xml version="1.0" encoding="UTF-8"?>
    <changelog>
         <entry>
              <date>2002-12-09</date>
              <time>14:21</time>
              <author><![CDATA[jmc]]></author>
              <file>
                   <name>develop/web/vds-rel1/c/su_rgd0_c.jsp</name>
                   <revision>1.9</revision>
                   <prevrevision>1.4</prevrevision>
              </file>
              <msg><![CDATA[moved cancel button into seperate for so it doesn't invoke js validation]]></msg>
         </entry>
         <entry>
              <date>2002-12-09</date>
              <time>13:41</time>
              <author><![CDATA[jmc]]></author>
              <file>
                   <name>develop/web/vds-rel1/c/su_pm0_c.jsp</name>
                   <revision>1.18</revision>
                   <prevrevision>1.124</prevrevision>
              </file>
              <msg><![CDATA[moved << and >> to the correct column]]></msg>
         </entry>     
    </changelog>
    and this is the XSL that i use
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
    version='1.0'>
    <xsl:param name="title"/>
    <xsl:param name="module"/>
    <xsl:param name="cvsweb"/>
    <xsl:output method="html" indent="yes" encoding="US-ASCII"
    doctype-public="-//W3C//DTD HTML 4.01//EN"
    doctype-system="http://www.w3.org/TR/html401/strict.dtd"/>
    <xsl:template match="*">
    <xsl:copy>
    <xsl:copy-of select="attribute::*[. != '']"/>
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="changelog">
    <html>
    <head>
    <title><xsl:value-of select="$title"/></title>
    <style type="text/css">
    body, p {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 80%;
    color: #000000;
    background-color: #ffffff;
    tr, td {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    background: #eeeee0;
    td {
    padding-left: 20px;
    .dateAndAuthor {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-weight: bold;
    text-align: left;
    background: #a6caf0;
    padding-left: 3px;
    a {
    color: #000000;
    pre {
    font-weight: bold;
    </style>
    </head>
    <body>
    <h1>
    <a name="top"><xsl:value-of select="$title"/></a>
    </h1>
    <p style="text-align: right">Designed for use with Ant.</p>
    <hr/>
    <table border="0" width="100%" cellspacing="1">
    <xsl:apply-templates select=".//entry">
    <xsl:sort select="date" data-type="text" order="descending"/>
    <xsl:sort select="time" data-type="text" order="descending"/>
    </xsl:apply-templates>
    </table>
    </body>
    </html>
    </xsl:template>
    <xsl:template match="entry">
    <tr>
    <td class="dateAndAuthor">
    <xsl:value-of select="date"/><xsl:text> </xsl:text><xsl:value-of select="time"/><xsl:text> </xsl:text><xsl:value-of select="author"/>
    </td>
    </tr>
    <tr>
    <td>
    <pre>
    <xsl:apply-templates select="msg"/></pre>
    <ul>
    <xsl:apply-templates select="file"/>
    </ul>
    </td>
    </tr>
    </xsl:template>
    <xsl:template match="date">
    <i><xsl:value-of select="."/></i>
    </xsl:template>
    <xsl:template match="time">
    <i><xsl:value-of select="."/></i>
    </xsl:template>
    <xsl:template match="author">
    <i>
    <a>
    <xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute>
    <xsl:value-of select="."/></a>
    </i>
    </xsl:template>
    <xsl:template match="file">
    <li>
    <a>
    <xsl:choose>
    <xsl:when test="string-length(prevrevision) = 0 ">
    <xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?rev=<xsl:value-of select="revision" />&content-type=text/x-cvsweb-markup</xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
    <xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?r1=<xsl:value-of select="revision" />&r2=<xsl:value-of select="prevrevision"/></xsl:attribute>
    </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="name" /> (<xsl:value-of select="revision"/>)</a>
    </li>
    </xsl:template>
    <!-- Any elements within a msg are processed,
    so that we can preserve HTML tags. -->
    <xsl:template match="msg">
    <xsl:apply-templates/>
    </xsl:template>
    </xsl:stylesheet>
    Thank you in advance for any help.

  • Getting xml tags for PO releases.

    I need some help in getting xml tags for PO releases.
    When I refer metalink they gave me the following for Std PO.
    Create a new Standard Purchase Order and DO NOT approve it. Let it be in Incomplete status. Go to
    concurrent requests and run the 'PO Output for Communication' concurrent
    program will the following parameters:
    Print Selection: All
    Purchase Order Number From: The PO # you just created
    To: The PO # you just created
    Test: Debug
    May I know for PO releases what are additional parameters.I tried to enter release numbers in addition to the above.Bit it did not work,..
    I am having issue in getting buyer contact phone for PO releases.So I am trying to see if the work_tele_phone is available for Po releases xml tags.
    Can anyone please advise
    prasamb

    To get the tag name, you can use the following XSL stylesheet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="node()">
    <xsl:value-of select="name()"/> <xsl:text> </xsl:text>
    <xsl:apply-templates/>
    </xsl:template>
    </xsl:stylesheet>

Maybe you are looking for