Transformation with xslt.

hi,
I have a simple problem which I don't remember how to extract the required information from the
XML document.
for example,
<AA>
<fish>
<brand>catfish</brand>
<brand>goldfish</brand>
</fish>
<blob>
<A>a1</A>
<B>b1</B>
</blob>
<AA>
how do I write a stylesheet that picks out only the child text node of <fish> element but not the entire elements. I thought the following stylesheet would do the trick, but instead it also included the <blob> text node.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="fish">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
my output--->
catfish
goldfish
a1
b1
would like this output -->
catfish
goldfish

Look up "built-in template rules" in any XSLT reference. If you have questions that are about XSLT and not about Java, this is a good place to ask them:
http://www.mulberrytech.com/xsl/xsl-list/

Similar Messages

  • Should not create any output file when transform with xslt file

    I have a xslt file, which I have make code to check the order status value.
    If OrderStatus != 'Reject' --> create attribute, element for output file
    Else OrderStatus = 'Reject' --> do not create attribute/element ==> output is the empty file.
    Requirement: if OrderStatus = 'Reject' --> do not create any output file.
    how to do with this requirement?
    any help will be appreciated!

    Do you mean the xslt file always return the output file?
    I have tested this xslt file following (only xslt file, not run in BizTalk project):
    Create a blank console application using visual studio and add attached xslt file to newly created console app. Next open the XSLT file and select input file and output files and start xslt debugging to create output file.
    I want to edit the xslt file how to cannot create output file in the case OrderStatus = Reject.
    I don't say in particualr xslt file, its actually your map as a whole that returns a output message on successful execution.
    since you are testing the xslt file as individual file, you are able to control it as per need.  i mean you can write incomplete code or any kind of output elements that are not present even in schema. But when you set the map properties to use external
    xslt , map completely relies on xslt and xslt has to produce output that matches the output schema structure.
    So you better test your xslt by  setting it to your map. Once you set map properties to use xslt, you can test your map by right clicking on map and choosing test map.
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Using transform api with xslt and DOM Nodes

    Hi,
    when trying to transform a xml document with xslt using the javax.xml.transform api
    providing an element node of a previously parsed document, I find that absolute
    paths are not recognized.
    The following program shows what I am basically doing (the class can be executed
    on the command line providing a stylesheet and xml instance):
    import java.io.*;
    import org.w3c.dom.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import javax.xml.parsers.*;
    class Transform {
    public static void main(String [] args) throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
         Transformer transformer = tfactory.newTransformer(new StreamSource(args[0]));
         DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder parser = dfactory.newDocumentBuilder();
         Document doc = parser.parse(args[1]);
         Element domElem = doc.getDocumentElement();
         // workaround
    //     StringWriter out = new StringWriter();
    //     Transformer id = tfactory.newTransformer();
    //     id.transform(new DOMSource(domElem),new StreamResult(out));
    //     String xml = out.toString();
    //     transformer.transform(new StreamSource(new StringReader(xml)), new StreamResult(System.out));
         transformer.transform(new DOMSource(domElem), new StreamResult(System.out));
    transformer.clearParameters();
    If I use this on e.g.
    xsl:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes" encoding="ISO-8859-1" method="xml"/>
    <xsl:template match="/">
    <xsl:value-of select="/foo/bar"/>
    </xsl:template>
    </xsl:stylesheet>
    xml:
    <foo>abc<bar>def</bar></foo>
    I get
    <?xml version="1.0" encoding="ISO-8859-1"?>
    abcdef
    instead of
    <?xml version="1.0" encoding="ISO-8859-1"?>
    def
    I think this is due to the fact, that the transformation does not recognize
    any absolutely adressed xpath correctly.
    From what I read in the API docs, I think what I'm doing should be ok.
    So: did I misunderstand something or is this a bug in the java libraries?
    I'm using j2sdk 1.4.1_01 on i386 linux.
    If I use the commented code (serializing the xml and doing the transformation
    with a StreamSource, that has to be parsed again), everything's fine.
    Of course it would be easier to parse the file directly in the example but in the
    real program, I already have a dom tree and want to transform a part of it.
    Any help appreciated.
    Thanks, Morus

    why?
    that's all the point of XSL: define what part of your
    XML you want in your XSL templates, there is no need
    to prepare a sub-DOM of your DOM.
    Ok. Right. That's an alternative.
    The problem remains, that there are some stylesheets originally written
    for the current solution and though they should work with the whole document
    as well, it's not certain.
    Actually I don't know if this ever worked. I did neither write this code nor maintained the system so far.
    btw. you would be faster by giving a StreamSource to
    your transformation.Probably yes. But that would imply to rewrite a lot of code.
    What is happening is:
    there is a SOAP answser containing a xml document as the result parameter.
    The SOAP answer is parsed (I guess by the soap classes already) and the
    result xml is extracted. That's where the element node I'm trying to transform
    stems from.
    Besides, I still don't see why DOMSource takes any node if only document nodes
    work.
    Thanks, Morus

  • Issue with xslt transform

    I'm having a problem with xslt transformations.
    I'm sending a DOMDocument to be transformed into a varchar2. The transformation was into html and I was then printing the returning varchar2 to a web page, along the lines of...
    htp.prn(Xslt.transform(domdoc, xslt.stylesheet( l_stylesheet_bfile)));
    I subsequently broke the varchar2 32k limit so I started playing with transforming into a dom instead of a varchar, then writing the dom to a clob and the printing the clob to the web page in 32k chunks.
    I noticed this produced different results than the first method. Now I'm assuming that this is not because xslt is doing the transformations differently but because it's trying to put my html into a well-formed DOMdocument. I have noticed, though, that things like & #160; seemed to have disappeared.
    Just wondering if I'm doing something wrong, and also any reason why the transform functionality doesn't have an output option of CLOB?
    Thanks
    Jason

    What is the DB version?

  • Transforming XML/XSLT : CDATA problem

    Hi!
    I have a problem transforming xml with XSLT using the API javax.xml.
    The result is correct until I have a CDATA section in my xml document.
    The transforming process encodes all the & < > (special characters) it finds in.
    This occurs problem for the follow of my treatement because the content of my CDATA is already encoded.
    For example, this xml code :
    <?xml version='1.0' encoding="ISO-8859-1" ?>
    <article>
    <article-contenu><![CDATA[Accent : &eacute; Signe : &lt;]]></article-contenu>
    </article>
    produces in my output :
    Accent : &amp;eacute; Signe : &amp;lt;
    This is my java code :
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(readerXml);
    Source xslSource = new StreamSource( fileXsl );
    // Generate the transformer.
    Transformer transformer = tFactory.newTransformer(xslSource);
    // Perform the transformation, sending the output to the response.
    transformer.transform(xmlSource, new javax.xml.transform.stream.StreamResult(sw));
    How can I tell the transformer not to do that?
    Thanks for your answers!

    I am having a similar problem. I have enclosed my text data in my xml file like this:
    <![CDATA[<b>Hello World!</b>]]>
    My select statement in my XSLT sheet is as follows:
    <xsl:value-of select="." disable-output-escaping="yes"/>
    I have tried setting xsl:output to text, to html, and to xml. The <, >, and & get converted to xhtml entities.
    Where should I begin to troubleshoot? If the Xalan xslt jars? My stylesheet. My xml doc? Java code?
    Any feedback welcome.

  • Problem with portlets with XSLT generating dynamic portal compatible links

    Hi,
    We're using XSLT to transform XML data to HTML in a portlet. The problem is that
    the XML contains headlines and we need to create links to the complete article,
    which has to be displayed in the same portlet. How do I create a portal comaptible
    link with XSLT? In the JSP you can use the netui tag library like:
    <netui:anchor action="..">
    link
    <netui:parameter name="id" value="{id}"/>
    </netui:anchor>
    but how can I achieve this with XSLT? We tried generating the xsl with a jsp,
    but this doesn't work since the data entered in the value attribute of the netui:parameter
    tag will be encoded causing the XSL transformer to fail.
    Is there an easy solution to this? Or can XSLT only be used with very simple content?
    Ard

    We're trying to display some news headlines, clicking a headline has to invoke
    an action to display the complete article in the same portlet (using pageflow).
    When displaying the articles we use XSLT like (this is a JSP generating XSLT):
    <?xml version="1.0"?>
    <%@ page contentType="text/x-xslt"%>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:template match="items">
    <xsl:apply-templates select="item"/>
    </xsl:template>
    <xsl:template match="item">
    <nobr>
    <%-- ###### Here we need an action link, with the title as a request parameter
    ###### --%>
    <xsl:value-of select="@title"/>
    </nobr>
    </xsl:template>
    </xsl:stylesheet>
    The XML is like:
    <items>
    <item title="some title"/>
    <item title="some other title"/>
    </items>
    We need to generate a portal compatible link which invokes an action (show_details)
    with the title of the article as a request parameter.
    I know how to do this in a JSP, but since the data is in XML we like to do this
    with XSLT.
    Can you help?
    Subbu Allamaraju <subbuATBeaDOTCom> wrote:
    Could you elaborate (perhaps with some xsl snippet generated by jsp)
    the
    failures you were getting with xslt?
    Subbu
    Ard van der Scheer wrote:
    Hi,
    We're using XSLT to transform XML data to HTML in a portlet. The problemis that
    the XML contains headlines and we need to create links to the completearticle,
    which has to be displayed in the same portlet. How do I create a portalcomaptible
    link with XSLT? In the JSP you can use the netui tag library like:
    <netui:anchor action="..">
    link
    <netui:parameter name="id" value="{id}"/>
    </netui:anchor>
    but how can I achieve this with XSLT? We tried generating the xsl witha jsp,
    but this doesn't work since the data entered in the value attributeof the netui:parameter
    tag will be encoded causing the XSL transformer to fail.
    Is there an easy solution to this? Or can XSLT only be used with verysimple content?
    Ard

  • Message transformation using XSLT

    Hi OSB Gurus,
    We are trying to implement following functionality using OSB.
    1. We have XML messages in a folder.
    2. Need to create a proxy service to take these messages and apply transformations using XSLT.
    3. After transformation, put the messages in a different folder which will be picked up by another message broker.
    Please give me some pointers about how i can design this. Also i would like to share my findings about the step 2, but having issues for defining input payload which should be defined in the step 1 above. I followed the document http://blog.jayway.com/2010/05/07/xslt-transformations-in-oracle-service-bus/ for registering the xslt transformation, but couldnot make it work as i am not sure about how i can integrate step 1 with step 2.
    Thanks so much in advance.

    Thanks for the suggestion. I will try and see. Here are the files:
    1. XML Input(Payload):
    <?xml version="1.0" encoding="UTF-8"?>
    <ODS>
         <LICENSE_TRANSACTION>
              <LIC_TRAN_ID>123</LIC_TRAN_ID>
              <LIC_CAMIS_ID>String</LIC_CAMIS_ID>
              <LIC_NBR>String</LIC_NBR>
              <LIC_STATUS_DATE>2000-01-01</LIC_STATUS_DATE>
              <LIC_ISSUE_DATE>2001-01-01</LIC_ISSUE_DATE>
              <LIC_EXP_DATE>2002-01-01</LIC_EXP_DATE>
              <LIC_INSP_REQ_FLAG>true</LIC_INSP_REQ_FLAG>
              <LIC_LAST_RENW_SNT_DATE>2003-01-01</LIC_LAST_RENW_SNT_DATE>
              <LIC_LAST_RENW_RCVD_DATE>2004-01-01</LIC_LAST_RENW_RCVD_DATE>
              <LIC_FED_TAX_ID>String</LIC_FED_TAX_ID>
              <LIC_NYS_TAX_ID>String</LIC_NYS_TAX_ID>
              <LIC_OPR_HRS_OPN_FROM>14:20:00</LIC_OPR_HRS_OPN_FROM>
              <LIC_OPR_HRS_OPN_TO>15:20:00</LIC_OPR_HRS_OPN_TO>
              <LIC_TEL_NBR>718-123-1234</LIC_TEL_NBR>
              <LIC_EMAIL_ID>String</LIC_EMAIL_ID>
              <LIC_FAX_NBR>718-123-1234</LIC_FAX_NBR>
              <LIC_NBR_OF_SEATS>10</LIC_NBR_OF_SEATS>
              <LIC_ENTITY_CREATE_DATE>2005-01-01</LIC_ENTITY_CREATE_DATE>
              <LIC_TRAN_CHG_DATE>2006-01-01</LIC_TRAN_CHG_DATE>
              <DETAIL>
                   <LICENSE>
                        <LIC_TYPE_CODE>String</LIC_TYPE_CODE>
                        <LIC_CAMIS_CODE>String</LIC_CAMIS_CODE>
                        <LIC_CAMIS_CLASS>String</LIC_CAMIS_CLASS>
                        <LIC_CAMIS_SUB_CLASS>String</LIC_CAMIS_SUB_CLASS>
                        <BUR_DESC>String</BUR_DESC>
                        <LIC_CODE_SHORT_DESC>String</LIC_CODE_SHORT_DESC>
                        <LIC_CODE_LONG_DESC>String</LIC_CODE_LONG_DESC>
                   </LICENSE>
              </DETAIL>
         </LICENSE_TRANSACTION>
         <STATUS>
              <STATUS_CAMIS_CODE>String</STATUS_CAMIS_CODE>
              <STATUS_SHORT_DESC>String</STATUS_SHORT_DESC>
              <STATUS_DESC>String</STATUS_DESC>
         </STATUS>
         <PREMISES_ADDRESS>
              <ADDR_BLDG_NBR>String</ADDR_BLDG_NBR>
              <ADDR_STREET>String</ADDR_STREET>
              <ADDR_LOCATION>String</ADDR_LOCATION>
              <BOROUGH_DESC>Queens</BOROUGH_DESC>
              <ADDR_CITY>String</ADDR_CITY>
              <ADDR_STATE>String</ADDR_STATE>
              <ADDR_ZIP_CODE>String</ADDR_ZIP_CODE>
              <ADDR_HEALTH_AREA>String</ADDR_HEALTH_AREA>
              <ADDR_HEALTH_CTR_DIST>String</ADDR_HEALTH_CTR_DIST>
              <ADDR_COMMUNITY_DIST>String</ADDR_COMMUNITY_DIST>
              <ADDR_BIN>String</ADDR_BIN>
              <ADDR_BLOCK_NBR>String</ADDR_BLOCK_NBR>
              <ADDR_LOT_NBR>String</ADDR_LOT_NBR>
              <ADDR_ASMBLY_DIST>String</ADDR_ASMBLY_DIST>
              <ADDR_CONGS_DIST>String</ADDR_CONGS_DIST>
              <ADDR_ST_SEN_DIST>String</ADDR_ST_SEN_DIST>
              <ADDR_CTY_COUN_DIST>String</ADDR_CTY_COUN_DIST>
              <ADDR_XCOORDINATE>123</ADDR_XCOORDINATE>
              <ADDR_YCOORDINATE>1234</ADDR_YCOORDINATE>
              <DATEOFBUILDINGBUILT>2010-08-11</DATEOFBUILDINGBUILT>
              <SCHOOLAREA>String</SCHOOLAREA>
              <POLICE>String</POLICE>
              <FIRE>String</FIRE>
              <LOWCROSSSTREET>String</LOWCROSSSTREET>
              <HIGHCROSSSTREET>String</HIGHCROSSSTREET>
              <ISPARK>false</ISPARK>
         </PREMISES_ADDRESS>
         <MAILING_ADDRESS>
              <ADDR_BLDG_NBR>String</ADDR_BLDG_NBR>
              <ADDR_STREET>String</ADDR_STREET>
              <ADDR_LOCATION>String</ADDR_LOCATION>
              <BOROUGH_DESC>Queens</BOROUGH_DESC>
              <ADDR_CITY>String</ADDR_CITY>
              <ADDR_STATE>String</ADDR_STATE>
              <ADDR_ZIP_CODE>String</ADDR_ZIP_CODE>
         </MAILING_ADDRESS>
         <BUSINESS>
              <BUS_TYPE_SHORT_DESC>String</BUS_TYPE_SHORT_DESC>
              <BUS_TYPE_LONG_DESC>String</BUS_TYPE_LONG_DESC>
              <BUS_ID>String</BUS_ID>
              <BUS_TRADE_NAME>String</BUS_TRADE_NAME>
              <BUS_CORP_NAME>String</BUS_CORP_NAME>
              <SITE_TYPE>String</SITE_TYPE>
              <DESCRIPTION>String</DESCRIPTION>
              <WEBSITE>String</WEBSITE>
              <AGE_RANGE>String</AGE_RANGE>
              <BUSINESS_PRINCIPAL>
                   <PRINCIPAL>
                        <BUS_PRNC_CAMIS_ID>124</BUS_PRNC_CAMIS_ID>
                        <BUS_PRNC_TITLE>String1</BUS_PRNC_TITLE>
                        <BUS_PRNC_FULL_NAME>String1</BUS_PRNC_FULL_NAME>
                        <BUS_PRNC_FNAME>String1</BUS_PRNC_FNAME>
                        <BUS_PRNC_LNAME>String1</BUS_PRNC_LNAME>
                        <BUS_PRNC_MNAME>String1</BUS_PRNC_MNAME>
                        <BUS_PRNC_DOB>2004-01-01</BUS_PRNC_DOB>
                        <HOMEPHONE>718-123-1234</HOMEPHONE>
                        <WORKPHONE>718-123-1234</WORKPHONE>
                        <FAX>718-123-1234</FAX>
                        <EMAIL>String1</EMAIL>
                        <CELLPHONE>718-123-1234</CELLPHONE>
                        <NOTES>String1</NOTES>
                        <STARTDATE>2004-01-01</STARTDATE>
                        <ENDDATE>2004-01-01</ENDDATE>
                        <ADDRESS>
                             <ADDR_BLDG_NBR>String1</ADDR_BLDG_NBR>
                             <ADDR_STREET>String1</ADDR_STREET>
                             <ADDR_LOCATION>String1</ADDR_LOCATION>
                             <BOROUGH_DESC>Queens</BOROUGH_DESC>
                             <ADDR_CITY>String1</ADDR_CITY>
                             <ADDR_STATE>String1</ADDR_STATE>
                             <ADDR_ZIP_CODE>String1</ADDR_ZIP_CODE>
                        </ADDRESS>
                   </PRINCIPAL>
                   <PRINCIPAL>
                        <BUS_PRNC_CAMIS_ID>123</BUS_PRNC_CAMIS_ID>
                        <BUS_PRNC_TITLE>String2</BUS_PRNC_TITLE>
                        <BUS_PRNC_FULL_NAME>String2</BUS_PRNC_FULL_NAME>
                        <BUS_PRNC_FNAME>String2</BUS_PRNC_FNAME>
                        <BUS_PRNC_LNAME>String2</BUS_PRNC_LNAME>
                        <BUS_PRNC_MNAME>String2</BUS_PRNC_MNAME>
                        <BUS_PRNC_DOB>2004-01-01</BUS_PRNC_DOB>
                        <HOMEPHONE>718-123-1234</HOMEPHONE>
                        <WORKPHONE>718-123-1234</WORKPHONE>
                        <FAX>718-123-1234</FAX>
                        <EMAIL>String2</EMAIL>
                        <CELLPHONE>718-123-1234</CELLPHONE>
                        <NOTES>String2</NOTES>
                        <STARTDATE>2004-01-01</STARTDATE>
                        <ENDDATE>2004-01-01</ENDDATE>
                        <ADDRESS>
                             <ADDR_BLDG_NBR>String2</ADDR_BLDG_NBR>
                             <ADDR_STREET>String2</ADDR_STREET>
                             <ADDR_LOCATION>String2</ADDR_LOCATION>
                             <BOROUGH_DESC>Queens</BOROUGH_DESC>
                             <ADDR_CITY>String2</ADDR_CITY>
                             <ADDR_STATE>String2</ADDR_STATE>
                             <ADDR_ZIP_CODE>String2</ADDR_ZIP_CODE>
                        </ADDRESS>
                   </PRINCIPAL>
              </BUSINESS_PRINCIPAL>
              <BUSINESS_INSURANCE>
                   <BUS_WRK_CMP_CARRIER>String</BUS_WRK_CMP_CARRIER>
                   <BUS_WRK_CMP_POLICY_NBR>String</BUS_WRK_CMP_POLICY_NBR>
                   <BUS_WRK_CMP_EXP_DATE>2004-01-01</BUS_WRK_CMP_EXP_DATE>
                   <BUS_DISB_INSU_CARRIER>String</BUS_DISB_INSU_CARRIER>
                   <BUS_DISB_INSU_PLCY_NBR>String</BUS_DISB_INSU_PLCY_NBR>
                   <BUS_DISB_INSU_PLCY_EXP_DATE>2004-01-01</BUS_DISB_INSU_PLCY_EXP_DATE>
              </BUSINESS_INSURANCE>
         </BUSINESS>
         <RECEIPT>
              <RCPT_PAYOR_NAME>String</RCPT_PAYOR_NAME>
              <RCPT_CASH_FLG>true</RCPT_CASH_FLG>
              <RCPT_REMIT_AMT>123</RCPT_REMIT_AMT>
              <RCPT_APLY_AMT>123.50</RCPT_APLY_AMT>
              <RECEIPT_DETAILS>
                   <RCPT_DET_PMT_AMT>123.51</RCPT_DET_PMT_AMT>
                   <RCPT_DET_PMT_DATE>2004-01-01</RCPT_DET_PMT_DATE>
                   <RCPT_DET_PMT_TIME>20:15:00</RCPT_DET_PMT_TIME>
                   <RCPT_DET_PMT_CHK_NBR>1111</RCPT_DET_PMT_CHK_NBR>
              </RECEIPT_DETAILS>
              <RECEIPT_DETAILS>
                   <RCPT_DET_PMT_AMT>23.50</RCPT_DET_PMT_AMT>
                   <RCPT_DET_PMT_DATE>2004-01-01</RCPT_DET_PMT_DATE>
                   <RCPT_DET_PMT_TIME>20:15:11</RCPT_DET_PMT_TIME>
                   <RCPT_DET_PMT_CHK_NBR>22222</RCPT_DET_PMT_CHK_NBR>
              </RECEIPT_DETAILS>
         </RECEIPT>
    </ODS>
    I will post remaining XSLT and output in my next posts.
    Thanks for your help.

  • Unable to refer to custom resource bundle in WPC content rendered with xslt

    Hi,
    I need to use the resource bundle messages inside WPC content.
    When rendered by standard xsl templates the  call to XSLTHelper class is done to retrieve message from the standard SAP resource bundle com.sap.nw.wpc.bundles.core.properties, like this:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                         xmlns:wpc="com.sap.nw.wpc.km.service.editor.hslt.XsltHelperCore">
    <xsl:value-of select="wpc:getString([key defined in sap bundle], string(/document/@locale))"/>
    The problem is that helper class doesn't provide any API to use custom bundles.
    I tried to create xslt helper (including config in KM), but that didn't succeed neither. It would return with error NoClassDefFound.
    Could you please help on configuring xslt helper and registering it with xslt rendering engine for Web Page Composer? I could not find any how-to guides on xslt helpers for WPC.
    Thanks in advance.
    Ruslan

    Hi
    Did you find a solution?
    Christof

  • Target XML attribute with XSLT

    Hello,<br />I have an xml file which looks like this:<br /><br /><PRODUCTS><br /><PRODUCT><br /><IMAGE href="file://./0001.tif"></IMAGE><br /></PRODUCT><br /><PRODUCT><br /><PRODUCTS><br /><br />Is there a way to target the href attribute of the PRODUCT element with XSLT?<br /><br />Thanks

    hi marco,
    > Thank you gregor, I'll take a look to this reference; I'm total newby to
    > XSLT, so any suggestions would be surely fine.. another question: do you
    > think it's better to work with XSLT or XmlRules?
    there is no short answer on this. it depends on your documents/data you
    want to process, what to achieve and you're knowledge in scripting vs.
    xslt. i use xmlRules for styling my documents, xslt for data transformation.
    in general you've got more control, especially over the rendered
    document, using xmlRules. if you want to process layout rules/guidelines
    in dependency of the actual document you have to render it first.
    complex data transformation and composition is better with xslt outside
    of indesign. i prefer to prepare my data (select relevant data,
    numbering, ...) with xslt.
    cheers,
    gregor

  • Can SAX be used with XSLT

    I'm having Java memory problems with 8.1.7 when using a large
    XML file and creating a XML DOM. One solution I may have found
    is to use SAX which will create seperate trees for each
    ROWSET/ROW instead of building the entire tree in memory like
    DOM. But I can't figure out how to use SAX with XSLT. I want
    each record written to the same text file using a XSLT
    template. Anyone know how to do this?

    The solution can be found in the XMLLoader application written
    by Steven Muench, in his book "Building Oracle XML
    Applications". It is also somewhere online under the book's
    O'Reilly pages but I don't have the exact URL.
    The solution is basically that the SAX model is used to parse
    the large file and build a DOM tree as each node is
    encountered. When the SAX model detects the closing tag of a
    subdocument (probably what would be in your <ROWSET></ROWSET>
    tags) then the current DOM tree is used to perform the proper
    database operation. Then the SAX parser goes on with life until
    it finds the next complete subdocument, etc. Pretty slick.
    XMLLoader takes as an argument, the stylesheet you want to apply
    to the data, so you can transform your XML data into something
    that now has the Oracle canonical format on the fly.
    There are numerous posts in this newsgroup regarding XMLLoader,
    and Muench regularly answers questions here as well.
    Good luck!
    Mike

  • Issue with XSLT For each loop in B2B Mapping

    Hi All,
    I am trying to map the inbound 997 Payload into Headers and Lines Table. I am using the For Each XSLT Construct to map the Loop AK2 of 997 into the 997 Lines Collection.
    Issue I am facing is that if the Loop AK2 is repeated for 33 times then for all the 33 times only its first element's value is getting passed into the target of mapping file.
    in coming payload
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0001</Element-329>
    </Segment-AK2>
    <Segment-AK5>
    <Element-717>A</Element-717>
    </Segment-AK5>
    </Loop-AK2>
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0002</Element-329>
    </Segment-AK2>
    <Segment-AK5>
    <Element-717>A</Element-717>
    </Segment-AK5>
    </Loop-AK2>
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0003</Element-329>
    </Segment-AK2>
    <Segment-AK5>After transformation using XSLT file the payload looks like as follows
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>33</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>34</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>35</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>36</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>37</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>the Element-329 of incoming source payload is mapped to trxSetControlNumber of target payload, the issue is obvious from the above XML data that trxSetControlNumber is always having the value 0001 for every occurence where as its expected to fetch the value of the element of its corresponding occurence not the first elements value.
    Please find below the xslt file code i used for mapping
    <ns0:XxmfiEdi997_AckHeadersCollection>
          <ns0:XxmfiEdi997_AckHeaders>
            <ns0:headerId>
              <xsl:value-of select='oraext:sequence-next-val("XXMFI_EDI_997_ACK_HEADERS_S","jdbc/MTSI-apps")'/>
            </ns0:headerId>
            <ns0:processFlag>
              <xsl:text disable-output-escaping="no">I</xsl:text>
            </ns0:processFlag>
             <ns0:xxmfiEdi997_AckLinesCollection>
              <xsl:for-each select="/ns1:Transaction-997/ns1:Loop-AK2">
                <ns0:XxmfiEdi997_AckLines>
                  <ns0:lineId>
                    <xsl:value-of select='oraext:sequence-next-val("XXMFI_EDI_997_ACK_LINES_S","jdbc/MTSI-apps")'/>
                  </ns0:lineId>
                  <ns0:trxSetIdentCode>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK2/ns1:Element-143"/>
                  </ns0:trxSetIdentCode>
                  <ns0:trxSetControlNumber>
                    <xsl:value-of select="ns1:Segment-AK2/ns1:Element-329"/>
                  </ns0:trxSetControlNumber>
                  <ns0:segmentError>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Loop-AK3/ns1:Segment-AK3/ns1:Element-720"/>
                  </ns0:segmentError>
                  <ns0:trxSetAckCode>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK5/ns1:Element-717"/>
                  </ns0:trxSetAckCode>
                </ns0:XxmfiEdi997_AckLines>
              </xsl:for-each>
            </ns0:xxmfiEdi997_AckLinesCollection>
          </ns0:XxmfiEdi997_AckHeaders>Is there something I am doing wrong in mapping or am I missing something here. Please suggest .
    Thanks in advance
    ~TK.

    Hi,
    In your xslt code within the for loop, for the trxSetIdentCode why are you using the xpath "/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK2/ns1:Element-143"? It should be just "ns1:Segment-AK2/ns1:Element-143". Similar changes for segmentError and trxSetAckCode also should be done. Remove the '/ns1:Transaction-997/ns1:Loop-AK2/' part from your xpath expressions inside the for loop and try it.
    Sahay

  • Problems in SQL transform with variable in statement

    Hi,
    I have an sql transform with a variable in the statement. It looks like this:
    SELECT * FROM I.X where I.X.CUSTOMERNUMBER IN ([$variable])
    I have a script running prior which sets the $variable = '\'366800\',\'000933\'';
    (the CUSTOMERNUMBER field is a string)
    The problem is when DI compiles the SQL with the variable value, it is replacing each single quote with two single quotes, and thus turning my list of values into a single string (as recognised by DB2).
    How can I work around this? The CUSTOMERNUMBER field is indexed and the table is very large, so I want to use a very efficient statement to retrieve the data. I'm inserting this data into a different database, so I can't use the sql() function to execute the query and insert the rows into a new table in the same database (don't have authority to do that).
    I also need the sql to be dynamic because the customer numbers required will change from time to time. They're listed in another database and I plan on writing a loop to set the $variable value to contain all values in the lookup table, but I can't use that in a join because its in a different database and would not be efficient.
    Does anyone have any ideas? I'm literally all out, have tried a wide range of things to no avail, and none of my colleagues can work it out either.
    Thanks very much,
    -Steve

    I assume the SQL Transform is used only because of that in-list, not for other reasons....
    In this book page here: https://boc.sdn.sap.com/node/20046 at the very bottom it isdescribed on how to use the pushdown_sql() function in a where clause to add *any* text of your choice into the select statement DI generates. In this example I used a "where exists" but you can easily change the text to
    where key=5 and       pushdown_sql('my_datastore', 'CUSTOMERNUMBER IN ([$variable])')    and gender='M'
    I used the key=5 and gender=M just to clarify the syntax (I hope).
    For the SQL Transform, I wonder if you need the [$variable] syntax as well....

  • Possible with XSLT mapping?

    Hi,
    I have source xml structure of format
    <Header fld1 fld2 fld3
    fld4 fld5 fld6  ><line   fld7 fld8 fld9 </line></header>
    Header occurence is 1---unbounded
    and line occurence is 0---unbounded
    and line items can exist or not for some header items.for some headers items can be single or multiple.
    I get xml files on sender side and need to convert to flat files ,so I am using sender file CC on sender and receiver file CC with FCC on the receiver side.
    I am able to get with receiver file FCC ,I know FCC can support two level heirarchies only.
    header1
    header2
    header3
    header n
    line x
    line y
    line z
    line n
    so i dont know to which header values the item values belong to.I need to get
    this structure
    header1....(if no items)
    header2....(let say 2 items)
    linex
    liney
    header3...(no items)
    header4....(one item)
    linez
    header n.....(again no items)
    so I have another Xi guy,he told me that we can achieve this by using a XSLT mapping rather than gaphical mapping which I am using now.
    so can we get the structure what I wanted with XSLT mapping or is it nothing with mapping and it is with adapter?(I think its nothing with mapping)
    I know we may get the required output structure by writing a module program and call that in the receiver file adapter.
    suggestions please.
    thank you,
    regards,
    Babu

    udo,
    sorry if I put in confusion with my structures of both source and target.I am trying to give little eloberate
    I have source  xml data like this.
    <Header1 fld1=1234 fld2="name1" fld3='SAP1"
    fld4='000" fld5=0 fld6="sdn1"</header>...............no line items here
    <Header2 fld1=123 fld2="name" fld3='SAP"
    fld4='00" fld5=0 fld6="sdn" ><line fld7=value1 fld8=value2 fld9=value3 /line><line fld7=value4 fld8=value5 fld9=value6 /line></header>.....two line items here
    <Header3 fld1=123 fld2="name" fld3='SAP"
    fld4='00" fld5=0 fld6="sdn" ><line fld7=value7 fld8=value8 fld9=value9 /line></header>......one line item here
    Header4 fld1=12345 fld2="name2" fld3='SAP2"
    fld4='0006" fld5=01 fld6="sdn2"</header>.......no line items here
    I want target flat file structure like this considering "~" (tild)as delimiter
    1234name1SAP100000~sdn1 ...................> flatfile values for header1(no item values for this header1)
    123nameSAP000~sdn..........................> flat file values for hader2
    value1value2value3...........................>line item values for header2
    value4value5value6...........................>line item values for header2(two line item values for this header2)   
    123nameSAP000~sdn..........................>values for hader3
    value7value8value9...........................>line item values for header3(one item values for this header3)
    12345name2SAP2000601~sdn2..................>values for header4(no item values for this header4)
    ................... like for n header values.

  • Using Starts-with XSLT function with XI

    Hi All,
    Any help is apperciated. I am using the starts-with xslt function and when i do so the message gets stucks in the queue. If i run code without the starts-with then is works??
    <xsl:for-each select="receipt/prod">
         <xsl:for-each select="carrier/carrier_detail/carrier">
               <xsl:choose>
                   <xsl:when test="carrier_type='CASE'">
                        <xsl:choose>
                             <xsl:when test="starts-with(carrier_barcode, '00')">
                                                   do something
                                            </xsl:when>
                                           <otherwise>
                                                 do something
                                           </otherwise>
    so on..
    when i try to process messsage using this xslt format it gets sysfail in the queue, but without it, it works fine.
    I need to a special format if the condition of barcode starts with 00

    Chirag,
    Create xslt on abap mapping using transaction SXLT_TOOL on XI abap stack. Copy paste same xslt code and run with test file. You can debug code or most likely you can see error message too.
    Actually your mapping raising an exception which result in sys-fail.
    Hope this will help.
    Nilesh

  • In Data Quality transform please explain Associate transform with the help of any example.

    In Data Quality transform please explain Associate transform with the help of any example.

    Hi Neha,
    If we are using multiple match transforms and consolidate the final output we will use associate transform .
    Let me explain with one example based on data quality blue prints for USA .
    We have customer/vendor data .     We need to find the duplicates .
    1. First  we will find the duplicates  on   Name and Address
    2. Second  we will find the duplicates on Name and Email
    3. Third we will find the duplicates on Name and Phone
    Here why we need to find the duplicates in multiple stages . If we are finding the duplicates on combination of  Name, Address, Email and Phone  we may not get proper duplicates   as we are finding the potential duplicates . That's why we are finding the duplicates on different combinations .
    In this case we will get the different group numbers for each match combination . Each combination name is there .
    We want to consolidate and give the group number to the whole set of duplicates . We will pass these  3 match groups to associative transform and generate the  consolidated match group for the input data.
    I hope you understand the concept .
    Thanks & Regards,
    Ramana.

Maybe you are looking for