Remove tags from XML using transformation

Can anybody tell me how to remove empty tags using xsl transformation.
<App_Data App="MOD" Name="Metadata_Id" Value="SP1282"/>
<App_Data App="MOD" Name="Metadata_Spec_Major_Version" Value=""/>
<App_Data App="MOD" Name="Metadata_Spec_Minor_Version" Value=""/>
My XML will have tags similar to above. My requirement is to remove all tags having attribute Value="". How can i achieve this using transformation.
Thanks
Krish

You need to add the xsi:nil="true" attribute to your xsl-construct to be able to ommit the xml-element which are empty.
To be able to do this you need to add a choose-when-otherwise xsl construct inside your mapping file to test for ""-values.
The xsi:nill='true' isn't supported in the transform-activity yet, you need to add this attribute manually inside your xsl-mapping file.
Kind regards,
Nathalie

Similar Messages

  • Remove element from xml using dom.

    i want to remove an element from an xml file using dom.
    i remove the element but the whole content of the file is also deleted.
    how can i rewrite the file.

    vij_ay wrote:
    subject :Remove element from xml,but if empty element in input file then output should be <tag></tag>, not like <tag.xml/>I assume you mean <tag/> but why do you want this? Any application that will not accept this valid XML construct is flawed and a bug report should be raised against it.

  • How to remove xmlns from xml using java

    Hi,
    <DLList xmlns="http://www.test.com/integration/feed" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    </DLList>
    The above xml needs to be decomposed using xsu.I am facing a small problem because the xml has namespaces.
    How to remove the namespace using java to get the below xml
    Note:I am using XSLT for the transformation.The XSLT tag is not identifying the <DLList> tag with name space
    <DLList>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    </DLList>
    Please help.Let me know if any other information is required
    Thanks

    OK, here goes :
    For the example, I'll use a TB_DISTRICT table with the following structure :
    create table tb_district (
    sr_no number(3),
    district_name varchar2(100)
    );loaded with data from this page :
    http://india.gov.in/knowindia/districts/andhra1.php?stateid=KA
    and this XML document (one additional record compared to the one you posted) :
    <DLList xmlns="http://www.test.com/integration/feed" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Dharwad</ForecastName>
    <Humidity>70.1</Humidity>
    </Weather>
    </DLList>In order to access the XML, I'll also use this Oracle directory object :
    create directory test_dir as 'D:\ORACLE\test';Final relational tables are :
    create table BUSINESS_TABLE
      STATE         VARCHAR2(30),
      DISTRICT_NAME VARCHAR2(30),
      HUMIDITY      NUMBER
    );and
    create table REJECT_TABLE
      STATE         VARCHAR2(30),
      DISTRICT_NAME VARCHAR2(30),
      HUMIDITY      NUMBER,
      ERROR_MESSAGE VARCHAR2(500)
    );With XMLTable function, we can easily break the XML into relational rows and columns ready to use for DML :
    SQL> alter session set nls_numeric_characters=". ";
    Session altered
    SQL>
    SQL> SELECT *
      2  FROM XMLTable(
      3    XMLNamespaces(default 'http://www.test.com/integration/feed'),
      4    '/DLList/Weather'
      5    passing xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('CHAR_CS'))
      6    columns
      7      state         varchar2(30) path 'StateName'
      8    , district_name varchar2(30) path 'ForecastName'
      9    , humidity      number       path 'Humidity'
    10  )
    11  ;
    STATE                          DISTRICT_NAME                    HUMIDITY
    Karnataka                      Bagalkote                            89.9
    Karnataka                      Devengiri                            89.9
    Karnataka                      Dharwad                              70.1
    Then with a multitable insert, we load both the business table and the reject table (if the district name does not exist in TB_DISTRICT) :
    SQL> INSERT FIRST
      2    WHEN master_district_name IS NOT NULL
      3      THEN INTO business_table (state, district_name, humidity)
      4                VALUES (state, district_name, humidity)
      5    ELSE INTO reject_table (state, district_name, humidity, error_message)
      6              VALUES (state, district_name, humidity, 'Invalid district name')
      7  WITH xml_data AS (
      8    SELECT *
      9    FROM XMLTable(
    10      XMLNamespaces(default 'http://www.test.com/integration/feed'),
    11      '/DLList/Weather'
    12      passing xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('CHAR_CS'))
    13      columns
    14        state         varchar2(30) path 'StateName'
    15      , district_name varchar2(30) path 'ForecastName'
    16      , humidity      number       path 'Humidity'
    17    )
    18  )
    19  SELECT x.*
    20       , t.district_name as master_district_name
    21  FROM xml_data x
    22       LEFT OUTER JOIN tb_district t ON t.district_name = x.district_name
    23  ;
    3 rows inserted
    SQL> select * from business_table;
    STATE                          DISTRICT_NAME                    HUMIDITY
    Karnataka                      Dharwad                              70.1
    SQL> select * from reject_table;
    STATE                          DISTRICT_NAME                    HUMIDITY ERROR_MESSAGE
    Karnataka                      Bagalkote                            89.9 Invalid district name
    Karnataka                      Devengiri                            89.9 Invalid district name

  • Remove XML tags from XML element in Oracle

    Hi,
    I have a requirement where I have to remove all the xml tags from xml element with banks, currently I'm using replace 4 times to replace all different types of xml tags, performance is really bad. is there any better option to remove xml tags from xml data leaving the actual data. please find the example data below.
    select
    TO_CLOB(REPLACE(REPLACE(REPLACE(REPLACE
    ('<Concatcolumn><ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>','<ConcatGroupID>'),'<Concatcolumn>'),'</ConcatGroupID>',';'),';</Concatcolumn>')) AS Concatcolumn
    from dual
    **************Out put*************
    MyText Data goes here ;Data agian

    One way is to use xquery:
    SQL> with t as
    select xmltype('<Concatcolumn>
                          <ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>'
       ) xml from dual
    select xmlquery('string-join(//text(), ";")' passing xml returning content).getclobval() xml from t
    XML                                                              
    MyText Data goes here ;Data agian                                
    1 row selected.

  • How to remove Unicode from XML file

    I get following error when unmarshal xml:
    [java] org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x15) was found in the element content of the document.
    Anyone know how to remove Unicode from xml file? Can I remove the unicode by rebuild the file?
    Thanks

    These sort of error usually occur when you're using a different character encoding to read the file than the one you wrote it with. Perhaps if you were to post the problem section of the file and/or the code that created it in the first place.

  • Removing namespace from xml

    Hi,
    I have an xml which has some target namespace.
    I need to remove the namespace and the qualifiers and put it on a machine using a file adapter.
    Any help in this regard is highly appreciated.
    With Regards,
    Harsh

    Please go throught the below link
    Removing namespace from xml  created

  • Having problems removing tags from script.

    I'm not using the browser to run Adobe Story, but the Desktop version from my iMac.  Cmd + Double Click works, but once every 30 times.  Is anyone else having this problem removing tags from a script?

    There are other ways to remove tags from a script
    From Tagging Panel:
    - Open Tagging Panel from View Menu
    - Click on Edit button. Here you have the option to delete individual tag-items or remove all from the scene.
    From File Menu
    - Open File - Tagging menu
    Here you will find the options to delete all/manually added/automatically added tags.

  • Error when reading data from XML using JAXB?

    Hi all,
    I get the error message when reading data from XML using JAXB.
    [org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException
    (AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:481)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:199)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:142)
    I don't find the reason, please help!
    Thanks in advance!

    The problem is sovled.

  • Remove SOAP-ENV tags from xml RECEIVER RESPONSE payload (XSL needed?)

    Hi
    I need to remove some tags from the payload of a RESPONSE message in a SOAP webservice scenarion.
    The received payload looks like this:
    before -
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/what.xsd">
    <SOAP-ENV:Body>
      <ns:crejob-resp>
        <response-data>
          <Result>0</Result>
        </response-data>
      </ns:crejob-resp>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    after it should look like this
    after -
    <?xml version="1.0" encoding="UTF-8"?>
    <crejob-resp>
       <response-data>
          <Result>0</Result>
       </response-data>
    </crejob-resp>
    I was thinking of using XSL as a "pre-burner" step before my mapping program but need help to XSL on this.
    Hope somebody can help
    Cheers

    I am sorry to be such a pain in the a..
    But I still get the wrong result (with your first option, 2nd option is not working):
    <?xml version="1.0" encoding="UTF-8"?>
    <crejob-resp>
      <response-data>0<Result>0</Result></response-data>
    </crejob-resp>
    Hope u can help again
    and also my source can look like: (unbounded on response-data)
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/what.xsd">
    <SOAP-ENV:Body>
    <ns:crejob-resp>
       <response-data>
          <Result>0</Result>
       </response-data>
       <response-data>
          <Result>1</Result>
       </response-data>
       <response-data>
          <Result>2</Result>
       </response-data>
    </ns:crejob-resp>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Edited by: Bowie on Jul 2, 2009 3:08 PM

  • Remove Cdata tags from XML body

    Integration Broker message is being publish from the Peoplecode in the savepostchange event of a page......So basically when they click on the save, it is being published.
    ok, I have title field on a page and the user entered special character "&" and there is a HTML definition being used and that definition goes through parsexmlstring function.
    For example In the cust_title field on a page the user entered " A & B"
    I went to the HTML definition and wrapped cust_title field in the CDATA tags like <![CDATA[<Title>%BIND(:8)</Title>]]>
    Now , there is no error, XML is getting published. But in the xml message
    I see Cdata tags and string is appearing exactly as it was entered.....
    But how can I get rid of the Cdata tags from the XML message?

    Dear Odie,
    May I make your example a bit more complicated by adding an additional complexType, please:
    ---Original ----
    <DEPT>
    <EMPID>1</EMPID>
    <EMPNAME>Martin Chadderton</EMPNAME>
    <SALARY>??</SALARY>
    <SALARYq></SALARYq>
    </DEPT>
    ----- New ----
    <DEPT>
    <EMPID>1</EMPID>
    <EMPNAME>Martin Chadderton</EMPNAME>
    <SALARY>??</SALARY>
    <SALARYq></SALARYq>
    <EMPLMNT_HISTORY>
    <DEVISION>1</DEVISION>
    <FROM_DATE>2011-01-01 </FROM_DATE>
    <TO_DATE></TO_DATE>
    </EMPLMNT_HISTORY>
    </DEPT>
    Your solution works perfectly for <SALARY>, but how would you suggest also to deal with <TO_DATE> ?
    Massive thanks for your help!
    N.B. Just to emphasise, in my case I have 3 levels (complexType > complexType > complexType) and many elements and I would like to know if there is any generic option to say
    to remove all the empty elements from the result, as it causes to the SSJ (Systinet) Webservice to crash.

  • How to remove elements/attributes from XML using Xpath in XSLT ??

    Hello ,
    Is there anyway or method of Xpath from which I can delete the elements and attributes from XML at runtime ??
    Like I have such XML and I have to remove per attribute highlighted below
    <person per="and">
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    And want a result like this
    <person>
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    Thanks

    To achieve this you can use the bpelx:remove function: http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHJBJFD
    your assign will look like:
    <bpel:assign>
    <bpelx:remove>
    <target variable="person" query="/person/@per" />
    </bpelx:remove>
    </bpel:assign>
    Regards,
    Melvin

  • Remove  Namespace from XML File except Attribute

    Hi  XI  Experts ,
    1.I have referred to the code of xslt Generic XSLT Code to Remove ALL Namespaces from XML:
    http://forums.sdn.sap.com/thread.jspa?threadID=1920630
    But this removes the Attribute : id  from the records .
    My expected output is supposed to be :
    <?xml version="1.0" encoding="GBK"?>
    <body>
      <head>
        <nsrsbh>112001069711</nsrsbh>
        <nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
        <dcrq>20120209</dcrq>
        <sssq_q>20111201</sssq_q>
        <sssq_z>20120207</sssq_z>
        <records>4</records>
      </head>
      <data>
        <record id="1">
           <fpdm></fpdm>
        </record>
    </data>
    </body
    But after using this XSLT code it removes :id from <record_1 id=> and generated the below code :
    The xml file now doesn't contain teh attribute :id
    <?xml version="1.0" encoding="GBK"?>
    <body>
      <head>
        <nsrsbh>112001069711</nsrsbh>
        <nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
        <dcrq>20120209</dcrq>
        <sssq_q>20111201</sssq_q>
        <sssq_z>20120207</sssq_z>
        <records>4</records>
      </head>
      <data>
        <record>
          1
          <fpdm></fpdm>          
           </record>
    </data>
    </body>
    Could  you please provide your input
    Plaese note : Here  XI versin iS x1 3.0 SP7 . I have tried suing the Analyzer bean for the Encoing  of Chinese : GBK Intsead of UTF-8 in the Namespace  . But AF_Modules/XMLAnonymizerBean is not comptacible with XI 3.0 SP7
    Hence i have used the following code to remove namespcae and add  Encoding :GBK instead of UTF-8:
    <?xml version="1.0" ?>
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output encoding="GBK"/>
    <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>

    You could use exclude-result-prefixes.
    For example:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wt="http://www.example.com" exclude-result-prefixes="wt">
    </xsl:stylesheet>

  • Extra texts got spits out from XML XSL transformation?

    Hi:
    I was trying to output a transformed 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

    If your XSL doesn't specify what to do with a particular node, the default is to copy it to the output. That's what is happening to you. The remedy is for your XSL to specify a template for the root node ("/") that produces the output you want. Or something like that, your details are rather sketchy.

  • How to remove objects from pics using LR...

    I am not a professional photographer and I do not have a whole lot of photo editing knowledge. I started out several years ago using Photoshop elements 5 and eventually learned how to do several things like moving objects around or removing them from a photo, or moving someone's face into a different picture if their eyes were closed and lots of nice editing features. I loved it and still love it. My laptop was getting really old and slow so I just recently purchased a new computer which has windows 8 on it. I loaded my photoshop elements and cannot get it to open or work properly and am wondering if it's because of the windows 8 operating system. So I then decided to purchase a new photo editing software. I decided (quickly.. too quickly) to purchase adobe lightroom just because it had very good reviews online. Now I have several pictures that need to be edited for Christmas and I cannot find any "lasso tool" or any thing similar right now.. I was so used to using the layers and features from the PE and now my heart is broken because I feel so lost and maybe broke at the same time!! This program is soooo different than what I was used to using but I don't even know if I can do the same things with it. EXAMPLE: there is an air conditioner unit in one of the photos I've taken and I was planning on removing it from the picture. Also I was aiming on moving a face over from another picture because of some closed eyes.. Someone please tell me, is this program capable of doing these things or can I only play with the lighting in this? Will I have to spend more of my $$ to get another Photoshop elements to get the features I use?

    These tasks are tasks for Photoshop or Photoshop Elements, not for Lightroom, which is more an image data base.

  • Error removing data from MDS using WLST

    I'm new at MDS so i want to remove some data which I inserted in the wrong structure....sounds quite easy. After some looking around I should be able to do this using a deployment plan and WLST. I chose the last one as I am not realy familiar yet with deployment plans. I connect with my server and started WLST did the following:
    wls:/offline> connect ('weblogic', 'mypassword' , 't3://localhost:8001')
    Connecting to t3://localhost:8001 with userid weblogic ...
    Successfully connected to managed Server 'soa_server1' that belongs to domain 'MY_DOMAIN'.
    Warning: An insecure protocol was used to connect to the
    server. To ensure on-the-wire security, the SSL port or
    Admin port should be used instead.
    wls:/MY_DOMAIN/serverConfig> deleteMetadata(application='soa-infra', server='soa-server1', docs='/apps/deploy/*')The outcome was:
    Location changed to custom tree. This is a writable tree with No root.
    For more help, use help(custom)
    and after a while it closed the WLST connection. Can anyone tell me how I can remove data from my repository or what is going wrong here?
    Thanks in advance

    Hi,
    I think you were getting this error because you had your server name incorrect : soa-server1 instead of soa_server1. Also it might be possible that soa-infra is installed on the different server.
    Regards,
    Neeraj Sehgal

Maybe you are looking for

  • Windows Vista 64 and Itunes/Ipod

    Evening all, Was wondering if anyone has had any issues using Itunes or an Ipod with Windows Vista 64? Cheers

  • All in One Printer C5180 stopped printing/scanning from mac 10.6.8

    Hi My All-in-One C5180 has stopped printing and scanning from mac 10.6.8. It had worked for the past few years but after not using it for 8 months (out of country) it hasn't worked since I came back. I have done as a few suggested, carried out a soft

  • Windows 8.1 Pro WinHlp32.exe not running

    Immediately after Diskpart-Win80-Win81 fresh install, there are four (4) instances of WinHelp32 on our machine: C:\Windows\en-US\winhlp32.exe.mui C:\Windows\WinSxS\x86_microsoft-windows-winhstb.resources_31bf3856ad364e35_6.3.9600.16384_en-us_66fa9c27

  • Creation of Object in java

    Suppose I am having Class Box and I want to create only 50 objects please give me the code If i exceed above 50th object ie 51 for the class Box I must get an exception please help me for developing the code for Standalone application

  • Mime attachments in Mail from two mac users

    I've been receiving mime attachments in Tiger Mail from Ebay and members for a while and I've searched the forum for answers but haven't found a viable solution yet. I end up using TextEdit to open them. I've contacted ebay about this and they have n