Default XSLT Stylesheet to transform BW XML Data?

I'm currently working on a deafult XSLT Stylesheet to convert a BW XML Query Result Set into an html grid.
[code]
<!--
#==========================================================================
XSL Transformation that displays
Template Properties, List of Data Providers and List of Items
#==========================================================================
-->
<xml id="xsl_transform_1">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="header">
<tr bgcolor="white"> <xsl:for-each select="//RRWS_SX_TUPLE[1]/*">
  <td>
  <xsl:value-of select="local-name()"/>
  </td>
</xsl:for-each>
</tr>
</xsl:variable>
<xsl:template match="/">
<table bgcolor="gold" border="1">
TESTVALUE -
<tr>
  <xsl:copy-of select="$header" /> <xsl:apply-templates />
</tr>
<xsl:for-each select="//RRWS_SX_TUPLE">
      <tr>
        <td><xsl:value-of select="TUPLE_ORDINAL"/></td>
          <xsl:for-each select="//RRWS_S_CELL">           
          <td><xsl:value-of select="CELL_ORDINAL"></td>
          </xsl:for-each>
        <td><xsl:value-of select="TUPLE_ORDINAL"/></td>
        <td><xsl:value-of select="CHANM"/></td>
        <td><xsl:value-of select="CAPTION"/></td>
        <td><xsl:value-of select="CHAVL"/></td>
        <td><xsl:value-of select="CHAVL_EXT"/></td>
        <td><xsl:value-of select="NIOBJNM"/></td>
        <td><xsl:value-of select="TLEVEL"/></td>
        <td><xsl:value-of select="DRILLSTATE"/></td>
        <td><xsl:value-of select="OPT"/></td>
        <td><xsl:value-of select="SIGN"/></td>                    
        <td><xsl:value-of select="ATTRIBUTES"/></td>     
      </tr>
<xsl:for-each select="//RRWS_S_CELL">
     <tr>     
        <td><xsl:value-of select="CELL_ORDINAL"/></td> 
        <td><xsl:value-of select="VALUE"/></td>            
        <td><xsl:value-of select="FORMATTED_VALUE"/></td> 
        <td><xsl:value-of select="VALUE_TYPE"/></td> 
        <td><xsl:value-of select="CURRENCY"/></td> 
        <td><xsl:value-of select="UNIT"/></td> 
        <td><xsl:value-of select="MWKZ"/></td> 
        <td><xsl:value-of select="NUM_SCALE"/></td> 
        <td><xsl:value-of select="NUM_PREC"/></td> 
        <td><xsl:value-of select="CELL_STATUS"/></td> 
        <td><xsl:value-of select="BACK_COLOR"/></td> 
     </tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="RRWS_S_CELL/*">
<td> <xsl:value-of select="." /> </td>
</xsl:template></xsl:stylesheet>
</xml>
[/code]
I've started this, but I need to join the top tree with the bottom. Right now I'm just flattening the tree. Does anyone know if any work has been done in this area? I'm looking to create these XSLT Transforms. Also, I'd like to create generic javascript functions that I can use as an include, such as
function join_BW_Table(table1, table2, fieldtojoin, typeofjoin)
This would allow anyone to generically combine BW Data from multiple sources all on the FrontEnd and render it all as an html table. My ultimate goal would be have all this in includes and available for all BW Reporting. Anyone have any thoughts on:
1. Has this been done before?
2. If it hasn't, anyone have comments on how I can combine the 2 tables that I'm rendering with the attached XSLT transform?
I'm running these transforms via a javscript function on the load of the html page.
Prakash

Prakash,
did you ever compile the Stylesheet?  I am looking for an alternative way to format the pre-compiled XML file from the Report Designer.  The more complex my report is, the less robust the application becomes.
Your insight would be greatly appreciated.
Thank you

Similar Messages

  • BI Admin Tool and XSLT transformation for XML data source - How it works ?

    Hello,
    There is a possibility to import data from XML data source using BI Admin Tool.
    In the import window we can point XSLT file. What is the purpose of that XSLT field?
    Why I am asking ?
    I thought it is smth like XSLT processor, but simply it doesnt work.
    What I did:
    - I pointed XML data source file
    - I pointed XSLT transformation file
    - Click OK, and still get the message that the XML file structure is not supported
    After that I transformed that XML file with some desktop XSLT processor using the same XSLT file, and I tried to connect that file directly using BI Admin tool.Then it works. So it means that the transformation is ok.
    So basically one question comes to my mind in that situation:
    What is the purpose of XSLT field in BI Admin Tool when it comes to XML data source ?
    (it doesnt look like XSLT processor)
    Greetings
    /Michal

    Hi Mariano
    Why you need to use XSLT for transforming XML file into ABAP table
    Code is a part of some ABAP report. Looks like it is reading a file from file system and updating table after transformation
    If you have requirement like you need to read XML file and then insert the data into a SAP table
    You can use
    File to RFC
    File to Proxy scenario using SAP PI.
    Please provide more inputs on requirement to help
    Thanks
    Gaurav

  • XSLT help to transform an XML

    I need help writing and XSLT to transform an XML in InDesign.  I am new to XML and have no idea how to write an XSLT.
    We are trying to bring in data from a database using a query language that is having trouble creating the image tags the way we need it to.  Basically, I need to take this:
    <Project href="file://C:\My test phot.jpg">
    and transform it into this:
    <Project> <image href="file://C:\My test phot.jpg" />
    Can anyone help me with this?
    Thanks!

    Not sure I can help you with this, as my understanding of XSL is very limited.
    However, as a matter of trial and error, I find that if I transform this XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <Root>
         <Project href="file://C:\My test phot1.jpg">The first bit of textual content here</Project>
         <Project href="file://C:\My test phot2.jpg">The second bit of textual content here</Project>
         <Project href="file://C:\My test phot3.jpg">The third bit of textual content here</Project>
         <Project href="file://C:\My test phot4.jpg">The fourth bit of textual content here</Project>
         <Project href="file://C:\My test phot5.jpg">The fifth bit of textual content here</Project>
    </Root>
    ...with this XSLT:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:template match="/">
         <Root>
             <xsl:for-each select="/Root/Project">
               <Project>
                 <image><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute></image>
                 <xsl:value-of select="."/>
               </Project>
             </xsl:for-each>
         </Root>
       </xsl:template>
    </xsl:stylesheet>
    ...I end up with this XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <Root>
    <Project><image href="file://C:\My test phot1.jpg"/>The first bit of textual content here</Project>
    <Project><image href="file://C:\My test phot2.jpg"/>The second bit of textual content here</Project>
    <Project><image href="file://C:\My test phot3.jpg"/>The third bit of textual content here</Project>
    <Project><image href="file://C:\My test phot4.jpg"/>The fourth bit of textual content here</Project>
    <Project><image href="file://C:\My test phot5.jpg"/>The fifth bit of textual content here</Project>
    </Root>
    ...which seems what you're looking for.
    [I edited the original solution slightly by removing a wildcard.]

  • Complex transformation inserting xml data to oracle database.

    Hi,
    I Have one small Problem While loading xml data to a oracle database.
    In the XSD i have the Columns Like this.
    <Data>
    <Type_Trs>
    <T1>
    <T2>
    </Data>
    My Database contains only two columns
    For Example:
    Type_Trs
    Corr_Data.
    Now My problem is Based on Type_Trs Value i need to take values of T1 and T2 should be loaded in Corr_Data column.
    How to write Xsl transformation for this using <xsl:choose>.
    For Clearing the Question I am giving the Example.
    Case : 1
    <Data>
    <type_Trs>BO</Type_Trs>
    <T1>1</T1>
    <T2>2</T2>
    </Data>
    In the Example my type_trs is value 'BO', so the Data in table should be
    Type_Trs Corr_Data
    ======= =======
    BO 1
    Case : 2
    <Data>
    <type_Trs>CP</Type_Trs>
    <T1>1</T1>
    <T2>2</T2>
    </Data>
    In the Example my type_trs is value 'CP', so the Data in table should be
    Type_Trs Corr_Data
    ======= =======
    CP 2
    For doing this How can i write my XSL transformation based on the condition?
    Thanks in advances
    Regards
    GSR

    Why do you need a XSL transformation for this? Can you not get the results based on this select:
    SQL> SELECT DISTINCT EXTRACTVALUE (t2.COLUMN_VALUE, 'Type_Trs') type_trs,
                    CASE EXTRACTVALUE (t2.COLUMN_VALUE, 'Type_Trs')
                       WHEN 'BO'
                          THEN EXTRACTVALUE (t3.COLUMN_VALUE, 'T1')
                       WHEN 'CP'
                          THEN EXTRACTVALUE (t4.COLUMN_VALUE, 'T2')
                    END corr_data
               FROM TABLE
                       (XMLSEQUENCE
                           (EXTRACT
                               (XMLTYPE
                                   ('<Data>
                          <Type_Trs>BO</Type_Trs>
                          <T1>1</T1>
                          <T2>2</T2>
                          <Type_Trs>CP</Type_Trs>
                          <T1>1</T1>
                          <T2>2</T2>
                        </Data>'
                                '/Data'
                       ) t1,
                    TABLE (XMLSEQUENCE (EXTRACT (t1.COLUMN_VALUE,
                                                 '/Data/Type_Trs')
                          ) t2,
                    TABLE (XMLSEQUENCE (EXTRACT (t1.COLUMN_VALUE, '/Data/T1'))) t3,
                    TABLE (XMLSEQUENCE (EXTRACT (t1.COLUMN_VALUE, '/Data/T2'))) t4
    TYPE_TRS   CORR_DATA
    CP         2        
    BO         1        

  • Writing XSLT to perform transformation from XML to ABAP

    Hi,
    I've been struggling quite a bit with XSLT. I read several old discussions regarding transformations using ST and XSLT but I haven't been able to solve my problem.
    I have a requirement to build a program to convert XML to an internal table.
    I've been able to do it for smaller XMLs, but whenever I try to apply the same logic to a bigger XML it simply just doesn't work. I'm almost certain it has something to do with the way I wrote the XSLT but I haven't been able to figure out what.
    The XML I have to read from goes something like this:
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    -<AuditFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01">
         -<Header xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01">
              <AuditFileVersion>1.02_01</AuditFileVersion>
                   <CompanyID>50002</CompanyID>
                   <TaxRegistrationNumber>5000</TaxRegistrationNumber>
                   <TaxAccountingBasis>F</TaxAccountingBasis>
                   <CompanyName>Company</CompanyName>
                   <BusinessName>Business</BusinessName>
                   -<CompanyAddress>
                        <AddressDetail>Address</AddressDetail>
                        <City>city</City>
                        <PostalCode>333333</PostalCode>
                        <Country>PT</Country>
                   </CompanyAddress>
                   <FiscalYear>2013</FiscalYear>
                   <StartDate>2013-07-01</StartDate>
                   <EndDate>2013-07-31</EndDate>
                   <CurrencyCode>EUR</CurrencyCode>
                   <DateCreated>2013-08-02</DateCreated>
                   <TaxEntity>Global</TaxEntity>
                   <ProductCompanyTaxID>00</ProductCompanyTaxID>
                   <SoftwareCertificateNumber>00</SoftwareCertificateNumber>
                   <ProductID>product</ProductID>
                   <ProductVersion>00</ProductVersion>
                  <Email>email@com</Email>
                   <Website>www.s.pt</Website>
         </Header>
         -<MasterFiles xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.02_01">
              -<Customer>
                   <CustomerID>1</CustomerID>
                   <AccountID>ID</AccountID>
                   <CustomerTaxID>999999990</CustomerTaxID>
                   <CompanyName>Desconhecido</CompanyName>
                   -<BillingAddress>
                        <AddressDetail>Desconhecido</AddressDetail>
                        <City>Desconhecido</City>
                        <PostalCode>0000-000</PostalCode>
                        <Country>PT</Country>
                   </BillingAddress>
                   <SelfBillingIndicator>0</SelfBillingIndicator>
              </Customer>
              -<Customer>
                   <CustomerID>2</CustomerID>
                   <AccountID>Desconhecido</AccountID>
                   <CustomerTaxID>571</CustomerTaxID>
                   <CompanyName>Company</CompanyName>
                   -<BillingAddress>
                        <AddressDetail>detail</AddressDetail>
                        <City>city</City>
                        <PostalCode>0000-000</PostalCode>
                       <Country>PT</Country>
               </BillingAddress>
              <SelfBillingIndicator>0</SelfBillingIndicator>
         </Customer>
    ...and so on
    And the XSLT I've written so far is something like this:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
       <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
       <xsl:strip-space elements="*"/>
       <xsl:template match="/">
         <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
           <asx:values>
             <ICUSTOMER>
               <xsl:apply-templates select="//Customer"/>
             </ICUSTOMER>
           </asx:values>
         </asx:abap>
       </xsl:template>
       <xsl:template match="Customer">
         <item>
           <CUSTOMER_ID>
             <xsl:value-of select="CustomerID"/>
           </CUSTOMER_ID>
           <ACCOUNT_ID>
             <xsl:value-of select="AccountID"/>
           </ACCOUNT_ID>
           <CUSTOMERTAX_ID>
             <xsl:value-of select="CustomerTaxID"/>
           </CUSTOMERTAX_ID>
           <COMPANYNAME>
             <xsl:value-of select="CompanyName"/>
           </COMPANYNAME>
           <ADDRESSDETAIL>
             <xsl:value-of select="BillingAddress/AddressDetail"/>
           </ADDRESSDETAIL>
           <CITY>
             <xsl:value-of select="BillingAddress/City"/>
           </CITY>
            <POSTALCODE>
             <xsl:value-of select="BillingAddress/PostalCode"/>
           </POSTALCODE>
            <COUNTRY>
             <xsl:value-of select="BillingAddress/Country"/>
           </COUNTRY>
           <SELFBILLINGINDICATOR>
             <xsl:value-of select="SelfBillingIndicator"/>
           </SELFBILLINGINDICATOR>
         </item>
       </xsl:template>
    </xsl:transform>
    Like I said, I'm almost certain that the problem is with the XSLT, as it returns an empty table / ALV. I've used this method before and it worked...
    Any thoughts?
    Thank you

    Hello Goncalo,
    I think, there are two problems:
    1) The xmlns declaration within your xml is a problem for the SAP XSLT Processor.
    2) I have written a similar XSLT-report, which performs directly with your data. Perhaps this is not necessary if 1) is solved:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
       <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
       <xsl:strip-space elements="*"/>
       <xsl:template match="AuditFile">
         <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
           <asx:values>
              <xsl:apply-templates select="MasterFiles"/>
           </asx:values>
         </asx:abap>
       </xsl:template>
       <xsl:template match="MasterFiles">
             <ICUSTOMER>
               <xsl:apply-templates select="./Customer"/>
             </ICUSTOMER>
       </xsl:template>
       <xsl:template match="Customer">
           <CUSTOMER_ID>
             <xsl:value-of select="CustomerID"/>
           </CUSTOMER_ID>
           <ACCOUNT_ID>
             <xsl:value-of select="AccountID"/>
           </ACCOUNT_ID>
           <CUSTOMERTAX_ID>
             <xsl:value-of select="CustomerTaxID"/>
           </CUSTOMERTAX_ID>
       </xsl:template>
    </xsl:transform>
    Kind regards,
    Hendrik

  • XSLT Transform in XML Signature: Exception

    Hello,
    I have following problem with an XSLT tranform in my XML signature. Here is the code I use to add XSLT to signature:
    main() {
    DOMStructure stylesheet = new DOMStructure( getStylesheet() );
    XSLTTransformParameterSpec spec = new XSLTTransformParameterSpec( stylesheet );
    transforms.add( fac.newTransform( Transform.XSLT, spec ) );
    private Element getStylesheet() throws Exception {
         String stylesheet = //"<?xml version=\"1.0\"?>" +
                        "<xslt:stylesheet version=\"1.0\" xmlns:xslt=\"http://www.w3.org/1999/XSL/Transform\">\n" +
                        " <xsl:include href=\"http://extern XSLT\" />\n" +
                        " <xslt:template match=\"/\">" +
                        " <xsl:apply-imports />" +
                        " </xslt:template>" +
                        "</xslt:stylesheet>\n";
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         //dbf.setValidating( true );
         return dbf.newDocumentBuilder().parse( new ByteArrayInputStream( stylesheet.getBytes() ) ).getDocumentElement();
    I get following exception:
    javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.dsig.TransformException: com.sun.org.apache.xml.internal.security.transforms.TransformationException: Cannot find xslt:stylesheet in Transform
    Original Exception was com.sun.org.apache.xml.internal.security.transforms.TransformationException: Cannot find xslt:stylesheet in Transform
         at org.jcp.xml.dsig.internal.dom.DOMReference.transform(Unknown Source)
         at org.jcp.xml.dsig.internal.dom.DOMReference.digest(Unknown Source)
         at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.digestReference(Unknown Source)
         at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(Unknown Source)
    In google I cannot find any details what can be wrong.
    Any suggestions?
    Thanks in advance,
    errno

    Thanks for your response. Sorry - I tried both versions with xslt and xsl - doesn't worked -> the error in my post is actually caused through the multiple changes of this part of code. Here once again:
    private Element getStylesheet() throws Exception {
              String stylesheet = //"<?xml version=\"1.0\"?>" +
                                       "<xslt:stylesheet version=\"1.0\" xmlns:xslt=\"http://www.w3.org/1999/XSL/Transform\">\n" +
                                       " <xslt:include href=\"external XSLTl\" />\n" +
                                       " <xslt:template match=\"/\">" +
                                       " <xslt:apply-imports />" +
                                       " </xslt:template>" +
                                       "</xslt:stylesheet>\n";
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              //dbf.setValidating( true );
              return dbf.newDocumentBuilder().parse( new ByteArrayInputStream( stylesheet.getBytes() ) ).getDocumentElement();
    Thanks,
    errno

  • XSLT stylesheet template for Endeca Records

    Endeca Forge provides a Record Adapter which can load XML data, transformed (if required) to Endeca's XML record format by an XML Stylesheet Template (XSLT). This provides a way of getting XML into Endeca with a minimum of fuss, for data analysis, PoCs and for modest amounts of XML data in production applications.
    There was an XSLT template posted to Endeca Eden prior to the acquisition. The thread is still available at:
    http://eden.endeca.com/web/eden/forums/message_boards/message/99120
    Does anyone have a copy of the template?
    TG

    Hi TG,
    Template XSLT below. Its main feature is that it attempts to be XSLT-agnostic, other than identification of the start-record element/x-path. It could be optimized for specific XML structures, or modified to support more complex XML data.
    Note also the remarks about XSLT and larger XML data - as your XML source data gets larger, XSLT will become less attractive, and you'll want to implement a streaming or pull-parser approach (SAX, StAX).
    Best
    Brett
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Copyright 2012 Oracle, Inc. All Rights Reserved. -->
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" indent="yes" doctype-system="records.dtd" />
         <!--
              ========== About this stylesheet ==========
              This is a generic stylesheet for transforming an XML file into the XML record format accepted by Endeca Forge.
              The stylesheet is designed to be reasonably agnostic about the source XML format: the main configuration required is to identify
              one or more repeating record elements in the source XML.  The stylesheet creates the root RECORDS element, enclosing one RECORD element for each
              repeating element.
              Each RECORD element is then assigned any number of PROP name-value pairs created for each property, with each PROP containing
              a NAME attribute and a PVAL.  The stylesheet effectively "flattens" the XML into a RECORD, recursively fetching sub-elements and creating
              properties named according to the hierarchical path (think XPath).
              ========== Stylesheet configuration ==========
              Add your base source repeating elements as an xpath selector at ADD RECORD SELECTORS HERE below.
              The default example in the template is "item", which suites an RSS 2.0 feed.
              By default, the template will use full path property names.  To change to simple property names, change the variable
              use-simple-prop-names below to true().
              You can also change the path dividers used in full property names - see path-divider and attribute-divider variables below.
              ========== Examples ==========
              The first example used is an RSS 2.0 feed (note that there are other Endeca adapters for this type of data).
              Using full property names, this will produce records with the following properties:
              rss_channel_item_title
              rss_channel_item_description
              rss_channel_item_link
              rss_channel_item_guid_@isPermaLink
              and so on.  With simple prop names, only the last part of the name is used (after the last _ or @).
              The second example (sample.xml and sample_records.xml) shows how nested repeating elements within a record are folded-down to
              a multi-value property.
         -->
         <!-- change select to true() to use simple prop names -->
         <xsl:variable name="use-simple-prop-names" select="false()" />
         <xsl:variable name="path-divider">
              <xsl:text>_</xsl:text>
         </xsl:variable>
         <xsl:variable name="attribute-divider">
              <xsl:text>_@</xsl:text>
         </xsl:variable>
         <xsl:template match="/">
              <xsl:element name="RECORDS">
                   <!-- apply templates for each "repeating element" representing a single record -->
                   <!-- ADD RECORD SELECTORS HERE -->
                   <xsl:apply-templates select="//item" />
              </xsl:element>
         </xsl:template>
         <!-- one template with RECORD element for each template type applied above -->
         <xsl:template match="item">
              <xsl:element name="RECORD">
                   <xsl:call-template name="leaves-auto-subpaths" />
              </xsl:element>
         </xsl:template>
        <!-- calls the prop template for each leaf -->
        <xsl:template name="leaves-auto-subpaths">
            <!-- select all attributes-->
            <xsl:for-each select="@*">
                <xsl:call-template name="prop" />
            </xsl:for-each>
            <!-- select all leaf nodes -->
            <xsl:for-each select="*[not(*) and . != '']">
                <xsl:call-template name="prop" />
            </xsl:for-each>
            <!-- auto recurse subpaths -->
            <xsl:for-each select="*[*]|*[@*]">
                <xsl:call-template name="leaves-auto-subpaths" />
            </xsl:for-each>
        </xsl:template>
        <!-- creates the PROP element and calls prop-name and prop-pval -->
        <xsl:template name="prop">
            <xsl:element name="PROP">
                 <xsl:if test="$use-simple-prop-names">
                      <xsl:call-template name="prop-name-simple" />
                 </xsl:if>
                 <xsl:if test="not($use-simple-prop-names)">
                      <xsl:call-template name="prop-name-full" />
                 </xsl:if>
                <xsl:call-template name="prop-pval" />                 
            </xsl:element>
        </xsl:template>
        <!-- creates the NAME element -->
        <xsl:template name="prop-name-simple">
            <xsl:attribute name="NAME">
                <xsl:value-of select="name()" />
            </xsl:attribute>
        </xsl:template>
        <!-- creates the NAME attribute -->
        <xsl:template name="prop-name-full">
            <xsl:attribute name="NAME">
                 <!-- walk from root to current node, print name and underscore  -->
                <xsl:for-each select="ancestor-or-self::*">
                    <xsl:value-of select="name()" />
                    <xsl:if test="position() != last()">
                        <xsl:value-of select="$path-divider" />
                    </xsl:if>
                </xsl:for-each>
                <!-- pick up attributes -->
                <xsl:if test="not(namespace::*)">
                    <xsl:value-of select="$attribute-divider" />
                    <xsl:value-of select="name()" />
                </xsl:if>
            </xsl:attribute>
        </xsl:template>
        <!-- creates the PVAL element -->  
        <xsl:template name="prop-pval">
            <xsl:element name="PVAL">
                <xsl:value-of select="." />
            </xsl:element>
        </xsl:template>
    </xsl:stylesheet>

  • Can I use some JavaScript in an XSLT stylesheet?

    I have two related (I think) problems.
    I am using Dreamweaver CS4 in Windows XP, Service Pack 3.
    I have created an XSLT stylesheet that transforms a simple XML file into HTML. I have a very short JavaScript that writes the day's date into the document. It is a script that I have used in many other HTML pages. The XSLT stylesheet also has a Spry widget, an accordion, in one of its DIV elements. Originally, I developed the accordion as part of a Dreamweaver template, and it works fine there. I cannot get the scripts to work completely in Firefox and Internet Explorer.
    If I just link in the external JavaScript files, the XML document displays correctly in both browsers. Note that MY external JavaScript file is the definition of one function, today(). The other JavaScript file is the Spry js file for the accordion widget. Of course the widget displays, but is not functional.
    If I add the script to display the date (document.write(today()); document.close();) in one of the DIVs, Internet Explorer(7) displays the date correctly in the correct location AND displays all the other content correctly, including the accordion, which of course is not functional. However, FireFox (latest version) displays ONLY the date in a white background and NOTHING else, such as background image, other DIVs with content, the accordion widget, etc.
    If I add the script to instantiate the accordion widget, FireFox displays the date and nothing else, as before. Internet Explorer displays the date, the other content, and the accordion widget, as before, but the widget is still not functional, that is, the accordion does not close or open when the panels are clicked.
    So, do I have to be extra careful on where I place scripts in an XSLT? Or is there some reason why scripts in an XSLT file do not work? It seems that once the browser transforms the XML file into HTML, which includes the scripts, it should display correctly.
    Thanks,
    Van

    Not sure what you mean by a CDATA section. But here is the XSLT file showing the template for the root element. The script is included using a <script> element, inserted in the <head> element. Should it be some place else?
    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="Trial procedure.xml" -->
    <!DOCTYPE xsl:stylesheet  [
        <!ENTITY nbsp   "&#160;">
        <!ENTITY copy   "&#169;">
        <!ENTITY reg    "&#174;">
        <!ENTITY trade  "&#8482;">
        <!ENTITY mdash  "&#8212;">
        <!ENTITY ldquo  "&#8220;">
        <!ENTITY rdquo  "&#8221;">
        <!ENTITY pound  "&#163;">
        <!ENTITY yen    "&#165;">
        <!ENTITY euro   "&#8364;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title><xsl:value-of select="MovexUser/Title"/></title>
    <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
    <link href="resources/navigatorSpryAccordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body id="body">
    --- The JavaScript funtions are called inside DIV elements here. ---
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Can I have JavaScript in an XSLT stylesheet?

    I posted this first on the Dreamweaver forum, and it was suggested that I post here instead...
    I have two related (I think) problems.
    I am using Dreamweaver CS4 in Windows XP, Service Pack 3.
    I have created an XSLT stylesheet that transforms a simple XML file into HTML. I have a very short JavaScript that writes the day's date into the document. It is a script that I have used in many other HTML pages. The XSLT stylesheet also has a Spry widget, an accordion, in one of its DIV elements. Originally, I developed the accordion as part of a Dreamweaver template, and it works fine there. I cannot get the scripts to work completely in Firefox and Internet Explorer.
    If I just link in the external JavaScript files, the XML document displays correctly in both browsers. Note that MY external JavaScript file is the definition of one function, today(). The other JavaScript file is the Spry js file for the accordion widget. Of course the widget displays, but is not functional.
    If I add the script to display the date (document.write(today()); document.close();) in one of the DIVs, Internet Explorer(7) displays the date correctly in the correct location AND displays all the other content correctly, including the accordion, which of course is not functional. However, FireFox (latest version) displays ONLY the date in a white background and NOTHING else, such as background image, other DIVs with content, the accordion widget, etc.
    If I add the script to instantiate the accordion widget, FireFox displays the date and nothing else, as before. Internet Explorer displays the date, the other content, and the accordion widget, as before, but the widget is still not functional, that is, the accordion does not close or open when the panels are clicked.
    So, do I have to be extra careful on where I place scripts in an XSLT? Or is there some reason why scripts in an XSLT file do not work? It seems that once the browser transforms the XML file into HTML, which includes the scripts, it should display correctly.
    For now, I am trying to create a whole page XSLT, not fragments.
    Thanks,
    Van

    Not sure what you mean by a CDATA section. But here is the XSLT file showing the template for the root element. The script is included using a <script> element, inserted in the <head> element. Should it be some place else?
    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="Trial procedure.xml" -->
    <!DOCTYPE xsl:stylesheet  [
        <!ENTITY nbsp   "&#160;">
        <!ENTITY copy   "&#169;">
        <!ENTITY reg    "&#174;">
        <!ENTITY trade  "&#8482;">
        <!ENTITY mdash  "&#8212;">
        <!ENTITY ldquo  "&#8220;">
        <!ENTITY rdquo  "&#8221;">
        <!ENTITY pound  "&#163;">
        <!ENTITY yen    "&#165;">
        <!ENTITY euro   "&#8364;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title><xsl:value-of select="MovexUser/Title"/></title>
    <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
    <link href="resources/navigatorSpryAccordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body id="body">
    --- The JavaScript funtions are called inside DIV elements here. ---
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Problem with extracting Xml data source fields

    Post Author: new_crystal
    CA Forum: Crystal Reports
    Hi,
    I am creating a report which has a xml data source.
    I have a field named fieldvalue in the xml, I need to present this fieldvalue in a column format based on the name of the column heading which is another field in the database called fielddata
    here is what i want
    fielddata1     fielddata2    fielddata3 .......
    fieldvalue1    fieldvalue2   fieldvalue3......
    i have dragged the fieldvalue 3 times in the report and applied different formula for each one of them
    here is the eg. of the formula
    if ( = "A" ) then
    but it is not giving me the correct values pulled from the data source. for the first column it is pulling correctly but for the rest of the columns it is giving values as 0's.
    Can anyone help me out in this? It is pretty urgent!
    Thanks

    Post Author: tel
    CA Forum: Crystal Reports
    I have no idea how to format it in Crystal Reports (i'm new to it too), but if worse comes to worse, you can create an XSLT stylesheet to convert the XML into a format that is easier for Crystal to use. 
    In case you don't know XSLT is a programming language that is designed to convert one XML format into another.

  • How to store the XML data? file or database?

    i'm frustrate at it.
    If store XML data into files, then when i query any data,how can i search data using relationship as SQL?
    But if store XML data into database.How can i transform the xml data to the data table?
    Can any one give me an clear example.

    XML is perfect for data interchange and readability. However, to make it searchable you should resolve it properly into tables, in accordance of your own choice of model.
    1. Investigate the XML files and resolve the model
    <Person sex="male">John
    <Pet animal="dog">Doggy</Pet>
    <Pet animal="cat">Catty</Pet>
    </Person>
    2. Create the tables in your database, let one or several tables keep the raw xml for retrieval of original xml data.
    --- XMLDocument ---
    id XML_data
    --- Person ---
    id XML_Document_id sex name
    (foreign key)
    --- Pet ---
    id Person_id animal name
    (foreign key)
    3. Resolve data from the xml files and insert it into the database. Do this through your ContentHandler, or from your DOM model.
    --- XMLDocument ---
    id XML_data
    0 <Person>...</Person>
    --- Person ---
    id XML_Document_id sex name
    0 0 male John
    --- Pet ---
    id Person_id animal name
    0 0 dog Doggy
    1 0 cat Catty
    Gil

  • Is the transformation between XML document and 2 dimensions table important?

    To everyone:
    I am trying to write a paper on this topic.first ,i want to ask whether the transformation between XML data and table in RDBMS is important,because xml data is suitable to transfer from a point to another,but not for storage,so when the transfer begin a program(in DB2,the program is DB2 extender)should change the data format in table into a xml document.And vice versa,the destination point receive the xml document,maybe the same program would store it in table.
    so i wonder if such a program exists in the Oracle8i or later version,and the detail about how the program realizes above funciton.please tell me where can i find related paper or materials.
    thanks!

    To everyone:
    I am trying to write a paper on this topic.first ,i want to ask whether the transformation between XML data and table in RDBMS is important,because xml data is suitable to transfer from a point to another,but not for storage,so when the transfer begin a program(in DB2,the program is DB2 extender)should change the data format in table into a xml document.And vice versa,the destination point receive the xml document,maybe the same program would store it in table.
    so i wonder if such a program exists in the Oracle8i or later version,and the detail about how the program realizes above funciton.please tell me where can i find related paper or materials.
    thanks! That is all oracle XDK is for. You can transform query results to xml and xml back into RDBMS. Infact Oracle provides much more flexible way than a DB2 extender does. In DB2 you need to give a DAD before you get any XML. Oracle relies on the direct transformation of query results into XML and adds flexibility of XSL ontop of the data.
    You can get more information on XML technology section of OTN.
    Once you write the article can we get a chance to see it.

  • Retrieve xml data from a relational table(oracle) with datatype as xmltyp

    Hello Avijit, any resolution for this issue?

    hi .... I am trying to retrieve xml data from a relational table with datatype as xmltyp. The SQ is retrieving rows but the xml parser give transformation error . The transformation retrieve xml data from a relational table(oracle) with datatype as xmltyp returned a row error status on receiving an input row on group retrieve xml data from a relational table(oracle) with datatype as xmltyp.  ERROR : An XML document was truncated and thus not processed. Input row from SQ_XMLTYPE_TEST: Rowdata: ( RowType=0(insert) Src Rowid=5 Targ Rowid=5 DOCUMENT (DataInput:Char.64000:): "<?xml version='1.0' encoding='UTF-8'?><main><DATA_RECORD> <OFFER_ID>434345</OFFER_ID> <ADDR>sec -2 salt lake</ADDR> <CITY>kolkata</CITY> (DISPLAY TRUNCATED)(TRUNCATED)" )  thanks in advance Avijit

  • Transforming XML Data with XSLT in a servlet

    Trying to transform XML data using XSLT. The following code works fine outside of a servlet. But in a servlet it gives the following error :
    * Transformer Factory error
    javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXException: Namespace not supported by SAXParser
    javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXException: Namespace not supported by SAXParser
         at org.apache.xml.utils.DefaultErrorHandler.fatalError(DefaultErrorHandler.java:257)
         at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:813)
         at TransformationApp.XSLTTransformServlet.MyTransform(XSLTTransformServlet.java:79)
         at TransformationApp.XSLTTransformServlet.doGet(XSLTTransformServlet.java:39)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
         at org.apache.tomcat.core.Handler.service(Handler.java:287)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
         at java.lang.Thread.run(Thread.java:484)
    Several articles hinted at setting the factory namespace attribute to TRUE. I have tried that but same results. Here is the code :
    static Document document;
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    //factory.setNamespaceAware(true);
    //factory.setValidating(true);
    try {
    File stylesheet = new File(argv[0]);
    File datafile = new File(argv[1]);
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse(datafile);
    // Use a Transformer for output
    TransformerFactory tFactory =
    TransformerFactory.newInstance();
    StreamSource stylesource = new StreamSource(stylesheet);
    Transformer transformer = tFactory.newTransformer(stylesource);
    DOMSource source = new DOMSource(document);
    StreamResult result = new StreamResult(System.out);
    transformer.transform(source, result);
    } catch (TransformerConfigurationException tce) {
    // Error generated by the parser
    System.out.println ("\n** Transformer Factory error");
    System.out.println(" " + tce.getMessage() );
    // Use the contained exception, if any
    Throwable x = tce;
    if (tce.getException() != null)
    x = tce.getException();
    x.printStackTrace();
    } catch (TransformerException te) {
    // Error generated by the parser
    System.out.println ("\n** Transformation error");
    System.out.println(" " + te.getMessage() );
    // Use the contained exception, if any
    Throwable x = te;
    if (te.getException() != null)
    x = te.getException();
    x.printStackTrace();
    } catch (SAXException sxe) {
    // Error generated by this application
    // (or a parser-initialization error)
    Exception x = sxe;
    if (sxe.getException() != null)
    x = sxe.getException();
    x.printStackTrace();
    } catch (ParserConfigurationException pce) {
    // Parser with specified options can't be built
    pce.printStackTrace();
    } catch (IOException ioe) {
    // I/O error
    ioe.printStackTrace();
    Any help would be greatly appreciated.

    I don't know that this is true, but i think the problem is the classpath.
    The runtime has his own parser. This parser is befor your xalan.lib in the classpath and the
    parser from the runntime don't support namespace.
    Try Tomcat 4.
    Regard Dietmar

  • Transforming XML data into SVG line charts using XSLT

    Hi
    I am trying to transform revenue data from an XML file into an SVG line chart. The problem is that I am quite new to XPath and XSLT and whereas I can draw the grid for my chart I struggle drawing the lines using the data from the XML doc.
    The XML look something like the one below, and I would like to have one chart for each product and in each chart having the time on the x-axis and chart the revenue by regions.
    Any help on this is much appreciated.
    Thanks
    Peter
    <?xml version="1.0"?>
    <revenue>
    <caption>
    <heading>My title</heading>
    </caption>
    <date name="01/01/2003">
    <region name="Asia">
    <product_a>30</product_a>
    <product_b>12</product_b>
    <product_c>301</product_c>
    </region>
    </date>
    <date name="02/01/2003">
    <region name="Asia">
    <product_a>32</product_a>
    <product_b>12</product_b>
    <product_c>301</product_c>
    </region>
    <region name="America">
    <product_a>57</product_a>
    <product_b>31</product_b>
    <product_c>457</product_c>
    </region>
    </date>
    <date name="03/01/2003">
    <region name="Asia">
    <product_a>38</product_a>
    <product_b>12</product_b>
    <product_c>301</product_c>
    </region>
    <region name="America">
    <product_a>31</product_a>
    <product_b>9</product_b>
    <product_c>357</product_c>
    </region>
    </date>
    <date name="04/01/2003">
    <region name="Asia">
    <product_a>33</product_a>
    <product_b>12</product_b>
    <product_c>301</product_c>
    </region>
    <region name="America">
    <product_a>43</product_a>
    <product_b>16</product_b>
    <product_c>430</product_c>
    </region>
    </date>
    <date name="05/01/2003">
    <region name="Asia">
    <product_a>36</product_a>
    <product_b>12</product_b>
    <product_c>301</product_c>
    </region>
    <region name="America">
    <product_a>54</product_a>
    <product_b>1</product_b>
    <product_c>561</product_c>
    </region>
    </date>
    </revenue>

    You could try Jeni's XSLT utilities for SVG :
    http://www.jenitennison.com/xslt/utilities/svg-utils.html
    Specifically, the sample code provided, when a couple of SVG charts are being generated from XML data :
    http://www.jenitennison.com/xslt/utilities/svg-example.html
    Hope that helps.

Maybe you are looking for

  • Oracle v.7.3.4.4 support

    Is Oracle v.7.3.4.4 is still supported by Oracle? I've been looking around the Oracle website and it appears that Oracle v.7.3.4 is supported, but I see there's a v.7.3.4.5 patch level. I'm wondering if you have to be at this latest patch level to be

  • Pre and Post Sends

    Although I understand the principle and consequences of changing my sends from post to pre fader, I can't for the life of me think of a situation where this would be desirable. Can someone enlighten me? Cheers, Simon

  • TCS 5 RoboHelp and FrameMaker links work and then stop

    Hi, I installed TCS 5 after installing a trial of RoboHelp 11.  After I installed, I opened a project from TCS 4 and I was able to update an existing linked FM book and Link to new files.    The FM files were converted ot FM 12 and the RoboHelp proje

  • I have a windows 8 operating system and it won't let me install quicktime please help

    I have a windows 8 operating system and it wont let me install quicktime

  • Itunes 64 bit Windows 7 stops playing

    I have just installed the most recent Itunes 64 bit for Windows 7 (10.6.1.7) Itunes stops playing and becomes unresponsive after about 2 songs if there is nothing else running. If there is another program running, it happens after a minute. The probl