How to perform an xslt transformation on an xml document dynamically ?

Hi all,
I'd like to perform an xslt tranformation on a dynamically generated xml code. I'm looking for a tag which can by useful for it. The tag should take both xml code and xslt code, passed as String arguments (not as names of xml and xslt files). I tried to use xtags library and jstl:transform tag but it did not work. It worked only with plain xml code passed to x-tag. When I try to perform a transformation on a tag body containing an output text tag, the transformation formats only this tag, not its content.
For example:
<xtags:style xslt="xslName.xsl">
<h:outputText value="#{beanName.stringPropertyName}"/>
</xtags:style>
Thanks in advance
Message was edited by:
opad

The issue is in the logic f your XSL mapping.
Use the same source XML and use it with XML Spy to debug why it is not working as you want it to.
Regards
Bhavesh

Similar Messages

  • Poor performance of XSLT-transformation

    Hi, everyone
    I`ve got report in BI-publisher based on xsl-template.
    This template transforms flat xml-file in Excel file and displays the data in the likeness of a cross-tab.
    Everything looks fine, but when the input file is larger than 1 MB, then the output file is formed about 10-15 minutes.
    However, when the input file is less than 1 MB, I got the output file is less than 1 minute.
    How i can see where is the "bottleneck"?
    What i can do to improve performance of xslt-transformation?
    Thanks

    Hi,
    Sorry that did not respond sooner.
    We have gave the process of 1024 MB memory.
    It`s about 4100+ records in result xml.
    BIP version is 10.1.3.4 and java - 1.6.
    Xsl-template and Xml you can download here
    Thank you for reply =)

  • Performance of XSLT transformation

    Hello everybody,
    I´m trying to do some in-database XML transformations from one XML format to another with a rather complex xsl stylesheet of about 9000 lines of code which performs this transformation. At first I tested the XDK XSLT functionality by simply doing a Transformation over the JAXP API outside the Database. It performed not bad, altough the memory consumption was a little bit higher then Saxon or Xalan. After that I read about the possibilities of in-database transformation, which should consume less memory because of oracle´s xml features like scalable DOM, XML Indexing and Query Rewriting when using object relational or binary storage. So we loaded our testdata into the db (we are using 11gR2 on a test system with Intel Core2Duo @ 3GhZ and 3GB RAM), in different XML storage options (XMLTYPE CLOB, Binary, OR) and tried to do a XSLT transformation on the columns. But it isn´t working.
    The db seems not to be able to cope with the transformation although the parser and processor should be the same as the off-database transformation that was working well (or am I wrong?). After half an hour we aborted because the db hadn´t finished the transformation yet (the off-db transformation of this 100KB XML took less then a second). We tried indexing the columns with XMLIndex, didn´t work out, we tried both XMLTYPE´s XMLtransform() and dbms_xslprocessor.processxsl(), same problem, the DB is working and working with no result, after some time we have to terminate. With a simple teststylesheet the transformation is doing fine but our complex stylesheet seems to be the problem.
    My question is, why is the xslt performance so poorly with the complex stylesheet and why can I use the XDK Parser and Processor in an off-db transformation very efficiently but when doing the same transformation in the db it´s not working.
    Hope you can help me out a little bit I´m really running out of ideas.
    Greetz dirac

    Hi,
    The db seems not to be able to cope with the transformation although the parser and processor should be the same as the off-database transformation that was working well (or am I wrong?). No, the database built-in XSLT processor (C-based) is not the same as the XDK's Java implementation.
    There's also a C XSLT processor available for external transformation and working with compiled stylesheets, it should outperform the Java implementation.
    See : http://docs.oracle.com/cd/E11882_01/appdev.112/e23582/adx_c_xslt.htm#i1020191
    We tried indexing the columns with XMLIndex, didn´t work out, we tried both XMLTYPE´s XMLtransform() and dbms_xslprocessor.processxsl(), same problem, the DB is working and working with no result, after some time we have to terminate. With a simple teststylesheet the transformation is doing fine but our complex stylesheet seems to be the problem.XMLIndexes won't help at all in this situation.
    In my experience so far with the built-in engine, I've seen the best result when the XML document we want transform is stored as binary XML.
    I don't know about the scalable DOM (or "lazy" DOM loading) feature described in the documentation, seems it doesn't support complex transformations, much like functional vs. streaming evaluation for XQuery.
    Hope you can help me out a little bit I´m really running out of ideas.I'd be interested in a test case if you have the possibility (stylesheet + sample input XML). You can mail me at this address : mb[dot]perso[at]wanadoo[dot]fr
    If you can't, could you describe what kind of transformation you're performing and how can I reproduce that behaviour?
    Thanks.
    Marc.

  • How to apply an XSLT transformation in OSB

    Hello all ,
    I tried to made a simple example - that apply a simple XSLT transformation in OSB .
    I followed the http://blog.jayway.com/2010/05/07/xslt-transformations-in-oracle-service-bus/ example but still is not working in my project .
    If I apply the imported xslt over the xml in testing window is working fine .
    But the action to replace the content of the xml with the new one is not working.
    Here is the xslt
    <xsl:template match="/">
    <ns0:donateToFund>
    <arg0>
    <xsl:value-of select="/Report/CustomerName"/>
    </arg0>
    <arg1>
    <xsl:value-of select="/Report/CustomerNumber"/>
    </arg1>
    <arg2>
    <xsl:value-of select="/Report/ReportName"/>
    </arg2>
    </ns0:donateToFund>
    </xsl:template>
    and here is a xml sample
    - <Report>
    <ReportName>Customer Report</ReportName>
    <CustomerName>XXX</CustomerName>
    <CustomerNumber>3423</CustomerNumber>
    <GeneratedDate>2010-11-25 08:15:24.695</GeneratedDate>
    - <Rowset>
    - <Row>
    <Quantity>100154</Quantity>
    <CustomerPartNo>ee</CustomerPartNo>
    <eSiliconPartNo>ee</eSiliconPartNo>
    <Sector>ee</Sector>
    <Location>eee</Location>
    </Row>
    - <Row>
    In my action I put /Report as XPath ; body as variable and XSL fro transformation .
    Can anyone help to fix this ?
    Many thanks in advance,
    Stefan

    Following works for me:
    XSLT
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:template match="/" xmlns:ns0="http://tempuri.org">
    <ns0:donateToFund>
    <arg0>
    <xsl:value-of select="/Report/CustomerName"/>
    </arg0>
    <arg1>
    <xsl:value-of select="/Report/CustomerNumber"/>
    </arg1>
    <arg2>
    <xsl:value-of select="/Report/ReportName"/>
    </arg2>
    </ns0:donateToFund>
    </xsl:template>
    </xsl:stylesheet>Input to Proxy
         <Report>
         <ReportName>Customer Report</ReportName>
         <CustomerName>XXX</CustomerName>
         <CustomerNumber>3423</CustomerNumber>
         <GeneratedDate>2010-11-25 08:15:24.695</GeneratedDate>
         <Rowset>
         <Row>
         <Quantity>100154</Quantity>
         <CustomerPartNo>ee</CustomerPartNo>
         <eSiliconPartNo>ee</eSiliconPartNo>
         <Sector>ee</Sector>
         <Location>eee</Location>
         </Row>
         <Row>
         <Quantity>100154</Quantity>
         <CustomerPartNo>aa</CustomerPartNo>
         <eSiliconPartNo>aa</eSiliconPartNo>
         <Sector>aa</Sector>
         <Location>aaa</Location>
         </Row>
         </Rowset>
         </Report>Output of Proxy:
         <ns0:donateToFund       xmlns:ns0="http://tempuri.org">
         <arg0>XXX</arg0>
         <arg1>3423</arg1>
         <arg2>Customer Report</arg2>
         </ns0:donateToFund>I am using a single Replace action in the request pipeline.
    It works for both configs below:
    Replace [ entire node ] of [ ./* ] in [ body ] with [Xslt Resource: default/OTN/temp
    Input Document: $body/Report
    Variable Names And Bindings ]
    Or
    Replace [ Node Contents ] of [ . ] in [ body ] with [Xslt Resource: default/OTN/temp
    Input Document: $body/Report
    Variable Names And Bindings ]
    You need to ensure that if you are doing replace entire node of . in body or / in body then you should replace it with an XML whose root node is soap:Body. To achieve that you will need to change the XSL and add soap:Body as root of the output. Easier solution is to use replace contents of . body or replace entire node of ./* in body.

  • XSLT transformation for Single XML Output

    I want to save a book to a single XML document. Is it correct that I can do this by adding an xslt to merge the standard framemaker entity type output ? Can I easily reconfigure the standard Save As XML to acheive this? or do I need to add a new menu item and call the XSLT dialogue...
    any advice appreciated.
    Thanks!

    Tracey,
       A related discussion appeared in the FrameSGML Yahoo group recently. Much of what follows is what I wrote there.
       Your XML application (defined in structapps.fm or another application definition file) can specify an XSLT post-process. No need to change Save as XML or define a new menu item. Depending on what you want, the XSLT transform can be as simple as the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml"/>
        <xsl:template match="/ | node() | @*">
            <xsl:copy>
                <xsl:apply-templates select="@* | node()"/>
            </xsl:copy>
        </xsl:template>
    </xsl:transform>
    This is an identity transform that simply copies the interpreted input to the output. I've used the word "interpreted" here because XSLT does not distinguish among some variations of how content is entered. In particular, it does not distinguish between content in referenced general entities (which is what you want) or between attribute values that happen to be the same as the attribute default value and attributes that are not explicitly specified and hence use the default value.
    There are a few things to watch out for involving use of general entities.
    First, if you are using entity attributes for graphics, you'll need to modify the above slightly. It's probably easier to replace the entity attributes with file attributes, but if you want to keep the entities, the above needs to be extended to declare the entities.
    Second, if you are using and want to preserve entity references for special characters or variables, you'll need to account for them as well. See $FMHOME\Structure\xml\PreserveEntity\readme.pdf.
        --Lynne

  • Performance issues with FDK in large XML documents

    In my current project with FrameMaker 8 I'm experiencing severe performance issues with some FDK API calls.
    The documents are about 3-8 MBytes in size. Fortmatted they cover 150-250 pages.
    When importing such an XML document I do some extensive "post-processing" using FDK. This processing happens in Sr_EventHandler() during the SR_EVT_END_READER event. I noticed that some FDK functions calls which modify the document's structure, like F_ApiSetAttribute() or F_ApiNewElementInHierarchy(), take several seconds, for the larger documents even minutes, to complete one single function call. I tried to move some of these calls to earlier events, mostly to SR_EVT_END_ELEM. There the calls work without a delay. Unfortunately I can't rewrite the FDK client to move all the calls that are lagging to earlier events.
    Does anybody have a clue why such delays happen, and possibly can make a suggestion, how to solve this issue? Thank you in advance.
    PS: I already thought of splitting such a document in smaller pieces by using the FrameMaker book function. But I don't think, the structure of the documents will permit such an automatic split, and it definitely isn't an option to change the document structure (the project is about migrating documents from Interleaf to XML with the constraint of keeping the document layout identical).

    FP_ApplyFormatRules sounds really good--I'll give it a try on Monday. Wonder how I could miss it, as I already tried FP_Reformatting and FP_Displaying at no avail?! By the way, what is actually meant with FP_Reformatting (when I used it I assumed it would do exactly what FP_ApplyFormatRules sounds to do), or is that one another of Lynne's well-kept secrets?
    Thank's for all the helpful suggestions, guys. On Friday I already had my first improvements in a test version of my client: I did some (not all necessary) structural changes using XSLT pre-processing, and processing went down from 8 hours(!) to 1 hour--Yeappie! I was also playing with the idea of writing a wrapper to F_ApiNewElementInHierarchy() which actually pastes an appropriate element created in a small flow on the reference pages at the intended insertion location. But now, with FP_ApplyFormatRules on the horizon, I'm quite confident to get even the complicated stuff under control, which cannot be handled by the XSLT pre-processing, as it is based on the actual formatting of the document at run-time and cannot be anticipated in pre-processing.
    --Franz

  • How to extract the nodes of any given XML document ???

    Hello,
    Greetings! It is an interesting forum.
    A Snippet of XML Schema PurchaseOrder.xsd as given in user guide is as follows
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    version="1.0" xdb:storeVarrayAsTable="true">
    <xs:element name="PurchaseOrder" type="PurchaseOrderType"
    xdb:defaultTable="PURCHASEORDER"/>
    <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T">
    <xs:sequence>
    <xs:element name="Reference" type="ReferenceType" minOccurs="1"
    xdb:SQLName="REFERENCE"/>
    <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
    <xs:element name="Reject" type="RejectionType" minOccurs="0"
    xdb:SQLName="REJECTION"/>
    <xs:element name="Requestor" type="RequestorType"
    xdb:SQLName="REQUESTOR"/>
    <xs:element name="User" type="UserType" minOccurs="1"
    xdb:SQLName="USERID"/>
    <xs:element name="CostCenter" type="CostCenterType"
    xdb:SQLName="COST_CENTER"/>
    <xs:element name="ShippingInstructions" type="ShippingInstructionsType"
    xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
    <xs:element name="SpecialInstructions" type="SpecialInstructionsType"
    xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
    <xs:element name="LineItems" type="LineItemsType"
    xdb:SQLName="LINEITEMS"/>
    </xs:sequence>
    </xs:complexType>
    full schema is available in url
    http://download-west.oracle.com/docs/cd/B12037_01/appdev.101/b10790/xdb03usg.htm#BABBGIED
    The views use XPath expressions and functions such as extractValue() to define the mapping between columns in the view and nodes in the XML document. The following view is created on purchase order schema.
    Creating Relational Views On XML Content
    CREATE OR REPLACE view PURCHASEORDER_MASTER_VIEW
    (REFERENCE, REQUESTOR, USERID, COSTCENTER,
    SHIP_TO_NAME,SHIP_TO_ADDRESS, SHIP_TO_PHONE,
    INSTRUCTIONS)
    AS
    SELECT extractValue(value(p),'/PurchaseOrder/Reference'),
    extractValue(value(p),'/PurchaseOrder/Requestor'),
    extractValue(value(p),'/PurchaseOrder/User'),
    extractValue(value(p),'/PurchaseOrder/CostCenter'),
    extractValue(value(p),'/PurchaseOrder/ShippingInstructions/name'),
    extractValue(value(p),'/PurchaseOrder/ShippingInstructions/address'),
    extractValue(value(p),'/PurchaseOrder/ShippingInstructions/telephone'),
    extractValue(value(p),'/PurchaseOrder/SpecialInstructions')
    FROM PURCHASEORDER p;
    When we register XML Schema in Oracle 9i, the schema elements of XML documents are stored as XMLType, that is, stored using object-relational storage techniques.
    For a small schema, we could build the above view manually, but for large/nested schema, if we have query to build XML documents node list, it will help us to build Relational Views on XML Content.
    How do we extract the nodes of any given XML document through O-R structures or XML DB using XML DB functions?
    Any alternate thoughts are welcome.
    I appreciate your help.
    Regards
    Ram

    Ram
    Once again, I do not think that you can solve the problem you are trying to solve. Fundamentally you need to determine for a given element of a given complex type what are it's child elements. For each of those elements you then need to find out whether or not it in turn has child elements...
    Then you have to think about elements defined as ref rather than type, elements that are substituteable, and the rest of possibilities that can be described with XML Schema.
    If you can solve that problem you're a better man than I as the saying goes. Anyone rather than give you a fish, I'll show you how to at least put a worm on the hook..
    The following query gets the names of the elements inside a each of the global complex types
    Good luck, if you come up with a query to do this I'd love to see it...
    SQL> column COMPLEX_TYPE format A32
    SQL> column ELEMENT format A32
    SQL> --
    SQL> select extractvalue
    2 (
    3 value(ct),
    4 '/xs:complexType/@name',
    5 'xmlns:xs="http://www.w3.org/2001/XMLSchema"'
    6 ) COMPLEX_TYPE,
    7 extractvalue
    8 (
    9 value(et),
    10 '/xs:element/@name',
    11 'xmlns:xs="http://www.w3.org/2001/XMLSchema"'
    12 ) ELEMENT
    13 from resource_view,
    14 table
    15 (
    16 xmlsequence
    17 (
    18 extract
    19 (
    20 res,
    21 '/r:Resource/r:Contents/xs:schema/xs:complexType',
    22 'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"
    23 xmlns:xs="http://www.w3.org/2001/XMLSchema"')
    24 )
    25 ) ct,
    26 table
    27 (
    28 xmlsequence
    29 (
    30 extract
    31 (
    32 value(ct),
    33 '/xs:complexType/*/xs:element',
    34 'xmlns:xs="http://www.w3.org/2001/XMLSchema"'
    35 )
    36 )
    37 ) et
    38 where equals_path(res,'/home/SCOTT/poSource/xsd/purchaseOrder.xsd') = 1
    39 /
    COMPLEX_TYPE ELEMENT
    -------------------------------- ------------------------PurchaseOrderType Reference
    PurchaseOrderType Actions
    PurchaseOrderType Reject
    PurchaseOrderType Requestor
    PurchaseOrderType User
    PurchaseOrderType CostCenter
    PurchaseOrderType ShippingInstructions
    PurchaseOrderType SpecialInstructions
    PurchaseOrderType LineItems
    LineItemsType LineItem
    LineItemType Description
    LineItemType Part
    ActionsType Action
    RejectionType User
    RejectionType Date
    RejectionType Comments
    ShippingInstructionsType name
    ShippingInstructionsType address
    ShippingInstructionsType telephone
    19 rows selected.

  • How to obtain the encoding scheme for an XML document

    How do you go about reading the encoding scheme for an XML document??
    More specifically how do I read the line:
    <?xml version="1.0" encoding="UTF-8"?>
    (Using Win32 C++ XML Parser 2.0.3 as SAX).
    null

    I work mostly with the Java versions of the parser so you'll have to make the translation to C++. As far as I know, you can't use the SAX API to access to the encoding.
    You need to use the DOM along with Oracle's extension to the basic DOM functionality. Oracle's package, oracle.xml.parser.v2 defines a class which implements the Document interface called XMLDocument. This class has a method, getEncoding(), which returns the encoding. You would use the method in getDocument() in the Parser base class inherited by DOMParser to retrive the XMLDocument.
    Jeff

  • How do I using Workshop's XMLMap Defined XML Document ?

    Hi ,
    I wonder that how can call the Workshop's XMLMap Defined Document in Java
    Application Client.
    I need to get not returned Object but returned XML Document in Java
    Application Client.
    Regards.

    Here's a more complete example:
    * @jws:operation
    public org.w3c.dom.Document getPurchaseOrderAsDocument() throws org.xml.sax.SAXException
    Document doc = null;
    try
    DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = fact.newDocumentBuilder();
    doc = db.parse(new InputSource(new FileInputStream(new File("c:/temp/mypo.xml"))));
    catch (IOException ioe)
    throw new SAXException("IO exception occurred", ioe);
    catch (ParserConfigurationException pce)
    throw new SAXException("JAXP Parser configuration exception occurred", pce);
    return doc;
    HTH,
    Mike Wooten
    "dudwnrla" <[email protected]> wrote:
    Hi ,
    I wonder that how can call the Workshop's XMLMap Defined Document in
    Java
    Application Client.
    I need to get not returned Object but returned XML Document in Java
    Application Client.
    Regards.

  • How can I display XSLT transformer errors on a web page ?

    Hi,
    I have some JSP pages that access DB, create an XML based on DB data and then transform it into HTML through an XSLT stylesheet. Developing the XSL code it's easy to make mistakes and generate errors on trasformation, but what I receive on the web page is only a "Could not compile stylesheet" TransformerConfigurationException, while the real cause of the error is displayed only on tomcat logs. This is the code for transformation:
    static public void applyXSLT(Document docXML, InputStream isXSL, PrintWriter pw) throws TransformerException, Exception {
            // instantiate the TransformerFactory.
            TransformerFactory tFactory = TransformerFactory.newInstance();
            // creates an error listener
            XslErrorListener xel = new XslErrorListener();
            // sets the error listener for the factory
            tFactory.setErrorListener(xel);
            // generate the transformer
            Transformer transformer = tFactory.newTransformer(new SAXSource(new InputSource(isXSL)));
            // transforms the XML Source and sends the output to the HTTP response
            transformer.transform(new DOMSource(docXML), new StreamResult(pw));
    }If an exception is thrown during the execution of this code, its error message is displayed on the web page.
    This is the listener class:
    public class XslErrorListener implements ErrorListener {
        public XslErrorListener() {
        public void warning(TransformerException ex) {
            // logs on error log
            System.err.println("\n\nWarning on XEL: " + ex.getMessage());
        public void error(TransformerException ex) throws TransformerException {
            // logs on error log
            System.err.println("\n\nError on XEL: " + ex.getMessage());
            // and throws it
            throw ex;
        public void fatalError(TransformerException ex) throws TransformerException {
            // logs on error log
            System.err.println("\n\nFatal Error on XEL: " + ex.getMessage());
            // and throws it
            throw ex;
    }When I have an error in the XSL stylesheet (for examples a missing closing tag), I can find on tomcat logs the real cause of the error:
    [Fatal Error] :59:10: The element type "table" must be terminated by the matching end-tag "</table>".
    Error on XEL: The element type "table" must be terminated by the matching end-tag "</table>".but on my web page is reported just the TransformerConfigurationException message that is:
    "Could not compile stylesheet".
    How can I display the real cause of the error directly on the web page?
    Thanks,
    Andrea

    This code is part of a bigger project that let developers edit XSL stylesheets through a file upload on the system and we can't impose the use of any tool for checking the xsl. So, I need to display the transformer error on the web page.I see. This code is part of an editorial/developmental tool for developers to create and edit XSL stylesheets.
    As part of the editorial process, XSL errors during editing can be considered a normal condition. In other words, it is normal to expect that the developers will generate XSL errors as they are developing stylesheets.
    In this light, handling the XSL transformation errors is a business requirement that you need to handle. Using the Java Exceptions mechanisms, e.g. try / catch are inappropriate to handle business requirements, in my opinion.
    I suggest that you look at how you handle the occurence of XSL errors differently than what you currently have. You need to:
    (1) capture the Transformation exception on the server;
    (2) extract the message from the exception and put it into a message that can be easily understood by the user;
    The current error message that you have going to the web browser is not useful.
    And you should not have the Transformation exception sent to the web browser either.
    What you are attempting to do with the exception is not appropriate.
    Handle the Transformation exception on the Business tier and use it to create a useful message that is then sent to the Presentation tier. In other words, do not send Java exceptions to web browser.
    />

  • How to perform an XSLT Mapping Test

    Hi,
    I have defined an XSLT Mapping in XI and it seems to work, but when I perform a test in my Interface Mapping the source fields are not written on respective target fields. What is the problem?
    Thanks!

    The issue is in the logic f your XSL mapping.
    Use the same source XML and use it with XML Spy to debug why it is not working as you want it to.
    Regards
    Bhavesh

  • How to debug AIA XSLT transformation in Jdeveloper ?

    Hi AIA forum members,
    I need to Test and debug an AIA XSL transformation. Can i use Jdeveloper to do this ?
    I understand that we can test by right clicking and using the "Test" option but then again it fails while processing the XSL as it is unable to execute lookupXRef, lookupDVM and also is not able to recognise the oracle xpath extension functions.
    Rgds,
    Vik

    Hi Vik,
    If you are on 10g, I suggest you run a search on Metalink for AIA Jdeveloper Patch download. Install the patch for Jdeveloper on windows and then you should be able to test the XSLs.
    If its on 11g, am not sure, as I have just started looking for that patch.
    Cheers,
    - AR

  • XSLT Transformation ABAP to XML speacial treatment of empty elements

    Dear All,
    I have created a deep abap structure which basically reflects the structure of my XML file which I would like to generate later. I have created a transformation via transaction SE80->create XSLT Program. I am also using the ABAP command call transformation...
    I have made a few ammendments to my XSLT program where required.
    I am outputting data in a loop.
    But I got a problem with one field. I must check if this date field is initial.
    Which I did by using statement:
    <xsl:if test="ENDDATE='0000-00-00'">
    But if this field is initial I have to output the following tag:
    <ENDDATE ReasonForNull="9"></ENDDATE>
    Hence I defined an attribute below in my element as follows:
       <xsl:for-each select="INSTANCE/_-PIQGB_-INSTANCE_XML">
    <xsl:if test="ENDDATE='0000-00-00'">
       <xsl:element name="ENDDATE">
           <xsl:attribute name="ReasonForNull"/>  
        </xsl:element>
    </xsl:if>
       </xsl:for-each>
    Which generates now the output as follows and is quitwe close to the desired output:
    <ENDDATE ReasonForNull=""></ENDDATE>
    Can anybody make a suggestion how I can generate the desired output.
    I assume that I would have to assign a value to the attribute to get the right output. But I got no idea how I could this in the loop.
    Many thanks in advance.
    Rainer

    Hello Rainer
    The solution is quite simple. See the example below.
    " Sample XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="../tmp_EDI_ZZ_tests/Untitled2.xsl"?>
    <INVOIC02>
        <INSTANCE>
            <ENDDATE>2008-07-31</ENDDATE>
        </INSTANCE>
        <INSTANCE>
            <ENDDATE>0000-00-00</ENDDATE>
        </INSTANCE>
    </INVOIC02>
    " Stylesheet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output encoding="ISO-8859-1" method="xml" indent="yes"/>
        <xsl:template match="/*">
            <xsl:for-each select="INSTANCE">
                <xsl:choose>
                    <xsl:when test="ENDDATE='0000-00-00' ">
                        <xsl:element name="ENDDATE">
                            <xsl:attribute name="ReasonForNull">
                                <xsl:value-of select=" '9' "/>   " Set value for attribute !!!
                            </xsl:attribute>
                        </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="node()"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
        </xsl:template>
    </xsl:stylesheet>
    " Result of transformation:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ENDDATE>2008-07-31</ENDDATE>
    <ENDDATE ReasonForNull="9"/>
    Regards
      Uwe

  • How to perform a query to read an xml file in SCCM 2007

    Good,
    I need read knows how to read an csv file for a specific column after collecting the results, then put the PC's in a collection in particular.
    A greeting and thanks

    Good,
    What I want to do is create a query that examine a csv that is on a server. And after consideration and select the column that I am interested
    in(Name pc) be able to engage these data to a collection, clear is if it can be done in SCCM 2007
    A greeting and thanks

  • How can I open a link to an xml document with a specific helper application?

    I have an html file with links to multiple xml files. When I click on one of these links, I would like Firefox to use an application of my choosing (e.g., Xmetal) to open the xml file. It works great with sgml files, because I was able to associate the "sgml" content with my external application. I can't seem to make the same thing happen for xml files, though.

    Many people on this thread have a common problem, how to download documents that have a .XML extension and then be able to view/edit them in Word. The issue is that Firefox does not treat a file it receives with a .XML extension as a download candidate, it just displays the XML in a tree structure in a popup window or a new tab. If there was an option to automatically (by configuration) open a .XML file in Word or even if it was a manual select option, that would solve the problem. Today you have to go through the process of saving the page, then when the popup down window indicates is completed, you use the right mouse to select open, when then takes you to Word (assuming Word is configured in your OS to process .XML files. This process is difficult to teach to non technical people because it error prone. Any help would be greatly appreciated.

Maybe you are looking for