Functions in xsl:sort
Is it possible to use extension functions in the select attribute of xsl:sort? This way I could sort the nodes based on a computed value.
e.g. <xsl:sort select="myns:myextfunc(ELEM1, ELEM2)">
I tried using a standard XSL function like
<xsl:sort select="concat(ELEM1, ELEM2)"/> and it seems to work but when I try to use an extension function it fails.
TIA
null
With XML Parser 9.0.1 Production, this works for me:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://www.oracle.com/XSL/Transform/java/Ext">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="/Employees/Emp">
<!--
| Due to a bug, need to declare the extension namespace on
| the <xsl:sort> element itself.
+-->
<xsl:sort data-type="number" order="descending" select="ext:max(Salary,Bonus)"
xmlns:ext="http://www.oracle.com/XSL/Transform/java/Ext"/>
<xsl:value-of select="Name"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
public class Ext
public static double max( double n, double m ) {
return n > m ? n : m;
<Employees>
<Emp>
<Name>B</Name>
<Salary>10</Salary>
<Bonus>12</Bonus>
</Emp>
<Emp>
<Name>C</Name>
<Salary>25</Salary>
<Bonus>12</Bonus>
</Emp>
<Emp>
<Name>A</Name>
<Salary>10</Salary>
<Bonus>2</Bonus>
</Emp>
</Employees>If I make sure Ext.class is in my CLASSPATH, and transform the above XML by the above stylesheet, I get:
CBA
which is the reverse-numerically-sorted list of max() calculations.
Similar Messages
-
Hi all,
Ineed to use a sorting function in one of the transformations in a BPEL project. The version of BPEL and Jdev i am using is 10.1.3.4
Is it possible to use xsl:sort? If no, is there any alternative to perform sorting on the xml?
Regards
SilasIt should work as it is supported by xslt 2.0. Please refer to Error: "xsl:sort" XSL Element Currently not Supported in the transform
-
Hello,
Anyone know if there is a way to do something like this?
Original XML:
<item>
<word>word1</word><num>10</num><num2>9</num2>
</item>
<item>
<word>word2</word><num>5</num><num2>3</num2>
</item>
<item>
<word>word1</word><num>7</num><num2>6</num2>
</item>
I want to do something like group on <word> and sort accending on sum(<num>), min(<num2>) and end up with this:
<item>
<word>word1</word><num>17</num><num2>6</num2>
</item>
<item>
<word>word2</word><num>5</num><num2>3</num2>
</item>
Is this possible?
thanks,
chad.Here's a start. See Chapter 9 of my book for a complete explanation of how to exploit XSLT keys like database functional indexes to make grouping operations like this be fast in XSLT. It takes a bit to wrap your mind around why and how it works and the book has figures that help illustrate this.
<!-- chad.xml -->
<list>
<item>
<word>word1</word><num>10</num><num2>9</num2>
</item>
<item>
<word>word2</word><num>5</num><num2>3</num2>
</item>
<item>
<word>word1</word><num>7</num><num2>6</num2>
</item>
</list>
<!-- chad.xsl -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:key name="g" match="item" use="word"/>
<xsl:output indent="yes"/>
<xsl:template match="/">
<list>
<xsl:for-each select="list/item[generate-id(.)=generate-id(key('g',word)[1])]">
<xsl:sort data-type="number" select="sum(key('g',word)/num)"/>
<xsl:variable name="items-with-same-word" select="key('g',word)"/>
<item>
<word><xsl:value-of select="word"/></word>
<num><xsl:value-of select="sum($items-with-same-word/num)"/></num>
<num2><xsl:value-of select="sum($items-with-same-word/num2)"/></num2>
</item>
</xsl:for-each>
</list>
</xsl:template>
</xsl:stylesheet>This produces the output:
<list>
<item>
<word>word2</word>
<num>5</num>
<num2>3</num2>
</item>
<item>
<word>word1</word>
<num>17</num>
<num2>15</num2>
</item>
</list> -
Using document function in xsl template - not working in BI Publisher
Hi,
I have a requirement where I need to display the data in one xml file based on the contents of a second xml. I am using Oracle BI Publisher 10.1.3.4.1 and template used for report generation is xsl-fo.
1) ReportData.xml - contains the data xml
2) ReportFilter.xml - contains the display information.
I need to display the tags in the ReportData.xml based on the presence , absence of different tags in ReportFiler.xml
I guess one of the option is to declare 2 datasource as use concatenated datasources. However , I am trying to use the "Document" function that is available in xsl transformation to reference the display xml.
I have tried the different options for using the document function
*1) <xsl:variable name="filterCheck" select="document('ReportFilter.xml')"/>*
Errors out saying : XML-22021: (Error) Error parsing external document: 'Access not allowed : file:/
C:/OracleBI/oc4j_bi/bin/ReportFilter.xml '.
*2) <xsl:variable name="filterCheck" select="document('file:///C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out saying ; Caused by: oracle.xdo.parser.v2.XPathException: Access not allowed : file:/C:/Or
acleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml
*3) <xsl:variable name="filterCheck" select="document('C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out saying : Caused by: java.net.MalformedURLException: unknown protocol: c
at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:153
*4)<xsl:variable name="filterCheck" select="document('file:/C:/OracleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml')" />*
Errors out syaying : Caused by: oracle.xdo.parser.v2.XPathException: Access not allowed : file:/C:/Or
acleBI/xmlp/XMLP/DemoFiles/ReportFilter.xml
I have placed the document I need to access in all the 3 locations mentioned above
ie in my
*1) C folder*
*2) C:/OracleBI/oc4j_bi/bin*
*3) C:/OracleBI/xmlp/XMLP/DemoFiles*
Is there any special permissions that I need to grant to enable access to these files?
Please let me know if anyone has successfully made the document function to reference other xml documents in BI Publisher.
Regards
Sujith
Edited by: user10979469 on Dec 8, 2009 11:48 AMTim,
Thanks a lot for the reply. Set the option to enable external document access and it works perfectly.
Just for other who are looking at this post.
Go to the Report in BI Publisher
Click on Configure link on the top right
Go to the Section FO Processing
Disable external references - Server value is "True" . Set it to "False".
Apply changes.
Restarted the oc4j, just to be on safer side (not sure if this is required)
The document function will open documents from any location on your machine.
Thanks again Tim
Regards
Sujith -
Hi,
I am trying to call a small java function in XSL but while performing transformation I get following error
"Function not in namespaceError in XPath expression, Function not in namespace"
I am performing following steps:
1. Java class file placed in class path and classpath is set. Java class is a simple file with no main() function. There is only one function called calculate()
2. Defined a namespace in XSL
3. Calling a function from class file in XSL
My XSL looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fib="java:FibonacciNumber"
extension-element-prefixes="fib" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/" >
<xsl:value-of select="fib:calculate(number(.))"/>
</xsl:template>
</xsl:stylesheet>
Can someone please point out what I am missing out here?
Regards,
NitinPlease refer
http://www.devx.com/Java/Article/31675 -
Error using custom xpath function with XSL transformations in BPM
Hi,
We have created a custom xpath function for use with SOA Suite and BPM. This has been built as per specified within the http://docs.oracle.com/cd/E29597_01/dev.1111/e10224/bp_appx_functs.htm#SOASE11100. We have also reviewed the Oracle Sample for mapper-107-ExtensionFunctions (sample demonstrates the use of user-defined extension functions). This has been registered with jDeveloper and SOA within the oracle.soa.ext_11.1.1 (run ant to include in oracle.soa.ext.jar)
We ideally want to use this is BPM within an xsl. However when consuming this function is either BPEL or BPM using an xsl, the xsl fails with an error such as:
XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc("xsl/Transformation_1.xsl", $inputVariable.payload). The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: oramds:/deployed-composites/default/gwCustomXpathUtil_rev1.0/xsl/Transformation_1.xsl<Line 9, Column 113>: XML-22043: (Error) Extension function error: Method not found 'getWeekDayDate'. Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
In an Assign it operates fine and returns the expected result. We have included a combination of both of the Config files (ext-mapper-xpath-functions-config.xml and ext-soa-xpath-functions-config.xml) in the META-INF folder, however neither allow the use of this function in the XSL.
I believe there may be an issue getting the custom xpath functions within XSL files. Hence I have also raised an SR. Has anyone experiences of this?
Our SOA / BPM suite environment is using 11.1.1.6.4 and has the following patches applied:
13801175
14406487 (11.1.1.6.4 SOA Bundle)
13896993
13088538
Regards Dave
Edited by: DavidGaskell on Mar 14, 2013 10:08 PMHi All,
I am also facing the same issue...Experts can you please help us.
hi DavidGaskell, did you find any resolution, if so can you share it with me.....
Thanks,
RR -
Hotspot-clicking (Insert function) plus ALV Sorting
Hi,
I have a requirement where the ALV display has to be SORTED based on values entered/changed on a certain column. The sort works ok when used with a custom APPEND button for new records (always inserted at the bottom of the list).
However, it does not work correctly when used with the Hotspot-click (INSERT functionality). It looks like if you CLICK on a particular record onscreen, you are actually addressing the original record in that position before the SORT was effected.
Is the Hotspot-clicking (Insert functionality) possible with ALV sorting? The ideal solution would be to have the ALV sorted at PBO and also at PAI so that the user can change existing records and add new ones with the sorting being updated everytime ON_DATA_CHANGED is triggered.
Will appreciate any help on this.
Thanks!
MichaelHello Michael
Thanks for further specifying your requirements. I have created the sample variant ZUS_SDN_ALVGRID_HOTSPOT_SORT_1 which contains two differences as compared to its template:
Replace table VBAK with VBAP (so we have two levels of sorting: VBELN, POSNR)
Move SET_TABLE_FOR_FIRST_DISPLAY method call into PBO
When I click on the hotspot (VBELN) a new row entry for the order number is created. The sorting (VBELN, POSNR) is kept even though the new row has been appended to the itab.
*& Report ZUS_SDN_ALVGRID_HOTSPOT_SORT
*& Thread: Hotspot-clicking (Insert function) plus ALV Sorting
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1159431"></a>
REPORT zus_sdn_alvgrid_hotspot_sort.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE vbap.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syrepid,
gt_sort TYPE lvc_t_sort,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
ms_sel_row TYPE lvc_s_row. " selected row
CLASS-METHODS:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
sender,
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_data_changed.
FIELD-SYMBOLS: <lt_outtab> TYPE ty_t_outtab.
BREAK-POINT.
ENDMETHOD. "handle_data_changed
METHOD handle_hotspot_click.
" define local data
DATA: ls_outtab TYPE ty_s_outtab,
ld_msg TYPE bapi_msg.
BREAK-POINT.
CLEAR: lcl_eventhandler=>ms_sel_row.
ms_sel_row = e_row_id.
READ TABLE gt_outtab INTO ls_outtab INDEX e_row_id-index.
CONCATENATE 'Selected Sales Order = ' ls_outtab-vbeln ' / '
ls_outtab-posnr
INTO ld_msg.
message i398(00) with ld_msg.
" Trigger PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'INSERT'
* IMPORTING
* rc =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_vkorg TYPE vkorg DEFAULT '0001' OBLIGATORY.
START-OF-SELECTION.
** SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE gt_outtab
** UP TO 200 ROWS
** WHERE vkorg = p_vkorg.
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE gt_outtab
UP TO 100 ROWS.
PERFORM init_controls.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog.
PERFORM set_layout_and_variant.
PERFORM set_sorting.
" Register EDIT event
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER:
lcl_eventhandler=>handle_data_changed FOR go_grid,
lcl_eventhandler=>handle_hotspot_click FOR go_grid.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
* Display data
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = abap_true
is_variant = gs_variant
i_save = 'A'
* i_default = 'X'
is_layout = gs_layout
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
it_sort = gt_sort
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** CALL METHOD go_grid->refresh_table_display
*** EXPORTING
*** IS_STABLE =
*** I_SOFT_REFRESH =
** EXCEPTIONS
** finished = 1
** OTHERS = 2.
** IF sy-subrc ne 0.
*** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
** ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'INSERT'.
PERFORM insert_row.
WHEN OTHERS.
" Check for changed data at the frontend (= grid control)
CALL METHOD go_grid->check_changed_data( ).
ENDCASE.
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
others = 6.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
others = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog.
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'VBAP' " 'VBAK'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** LOOP AT gt_fcat INTO ls_fcat.
** CASE ls_fcat-fieldname.
** WHEN 'VBELN' OR
** 'ERDAT' OR
** 'ERZET' OR
** 'ERNAM' OR
** 'AUART' OR
** 'NETWR' OR
** 'WAERK'.
** CONTINUE.
** WHEN OTHERS.
** ls_fcat-no_out = abap_true.
** ENDCASE.
** MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
** ENDLOOP.
* Only non-key fields are editable
** ls_fcat-edit = 'X'.
** MODIFY gt_fcat FROM ls_fcat
** TRANSPORTING edit
** WHERE ( fieldname NE space ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING hotspot
WHERE ( fieldname = 'AUART' OR
fieldname = 'VBELN' ).
** DELETE gt_fcat FROM 15 TO 99.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_layout-cwidth_opt = abap_true.
gs_variant-report = syst-repid.
gs_variant-handle = 'GRID'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
*& Form SET_SORTING
* text
* --> p1 text
* <-- p2 text
FORM set_sorting .
* define local data
DATA: ls_sort TYPE lvc_s_sort.
REFRESH: gt_sort.
CLEAR: ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'VBELN'.
ls_sort-up = abap_true.
APPEND ls_sort TO gt_sort.
CLEAR: ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'POSNR'.
ls_sort-up = abap_true.
APPEND ls_sort TO gt_sort.
ENDFORM. " SET_SORTING
*& Form INSERT_ROW
* text
* --> p1 text
* <-- p2 text
FORM insert_row .
* define local data
DATA: ls_outtab TYPE ty_s_outtab,
ld_order TYPE vbeln.
READ TABLE gt_outtab INTO ls_outtab
INDEX lcl_eventhandler=>ms_sel_row-index.
ld_order = ls_outtab-vbeln.
" Find last item of sales order
LOOP AT gt_outtab INTO ls_outtab
WHERE ( vbeln = ld_order ).
ENDLOOP.
" Create next item:
add 10 to ls_outtab-posnr.
" NOTE: added at the end of the list
APPEND ls_outtab TO gt_outtab.
" NOTE: insert new row AFTER selected row => works, too
** INSERT ls_outtab INTO gt_outtab
** INDEX lcl_eventhandler=>ms_sel_row-index.
ENDFORM. " INSERT_ROW -
Calling javascript functions from xsl on mac safari
Hi,
I am having a problem calling external javascript functions from xsl on mac safari, i am trying to generate a dropdown dynamically from an xsl document using XSLTProcessor through javascript, following is the code snippet of the xsl document
<select name="ddl_EmailSubType" class="Menu" onclick="onEmailSubTypeChange();" id="ddl_EmailSubType" >
<xsl:for-each select="./SubTypeFields/FieldGroup">
<xsl:if test="@SubTypeGroup != 'All'">
<option>
<xsl:attribute name="value">
<xsl:value-of select="@SubTypeGroup"/>
</xsl:attribute>
<xsl:if test="@SubTypeGroup = $SelectedSubContentType">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="@SubTypeGroup"/>
</option>
</xsl:if>
</xsl:for-each>
</select>
here the function onEmailSubTypeChange() is present in an external js file, all the other functions from this files are executed successfully except the ones which are defined in the xsl document.
I have also tried replacing onclick="onEmailSubTypeChange();" with onclick="javascript:alert('hello world');" but the event is not getting fired at all since i cannot see any alert on the selected item change of the dropdown.
Is there a way in which i can achieve this ?
any helps appreciated.
Thanks in advance
Vikas Mestry.Hi,
you can use this example VI
Regards,
Aurélien J.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> Du 30 juin au 25 août, embarquez pour 2 mois de vidéo-t'chat ! Prenez place pour un voyage au coe...
Attachments:
browser gps.vi 23 KB -
Xsl:sort attribute value templates for select and order
I've tried the xdk_java_9_0_1_0_0.tar.gz update today and for that the reported bugs are still there : one urgent (quite a stopper for us) is this one
<xsl:template match="/resultlist">
<xsl:variable name="sortorder">descending</xsl:variable>
<xsl:variable name="sortfield">name</xsl:variable>
<xsl:for-each select="result">
<xsl:sort select="./{$sortfield}" order="{$sortorder}"/>
<xsl:value-of select="./index"/>,<xsl:value-of select="./name"/>
</xsl:for-each>
</xsl:template>
still it does not replace {$sortfield} and {$sortorder}.This is known bug 1798018 in the Oracle XSLT processor.
The only workaround I can think of is to use <xsl:choose> to optionally use different <xsl:for-each> blocks, one with order="ascending" and one with order="descending" as literal values. -
XSL:SORT not supported in current XSL-transformator
In iCS 5.1 the use of the xsl element sort (<xsl:sort>) in an xsl stylesheet does not sort the set of processed nodes (<xsl:for-each ...>) as we would expect it, but simply copies the xsl element <XSL:SORT> to the output stream at every location, where it is defined in the stylesheet (at the start of the output of each processed node) . This behavior is not according the W3C XSLT 1.0 specification. Are there any solutions available?
Thanks in advance,
Jakob.This question is related to xsl rathar than java/xml.Then it would be better if you asked it in a place where experts in XSL answer questions. Check out the Mulberry mail-list.
This sort DOES NOT work (used xsl variable in xsl:sort)
<xsl:for-each select="PerformanceVO">
<xsl:sort data-type="number" select="$sortColumn"
order="ascending"/>
</xsl:for-each> I am pretty sure that must be an XSLT FAQ. I haven't looked but I bet you will find it in Dave Pawson's FAQs. -
Xsl:sort order attribute value template
I am trying the use the following in XDB 10.1.0.2
<xsl:sort order="{$myOrder} ...
It appears that the order attribute does not allow an attribute value template.
Any suggestions would be appreciated.
AnthonyThis is known bug 1798018 in the Oracle XSLT processor.
The only workaround I can think of is to use <xsl:choose> to optionally use different <xsl:for-each> blocks, one with order="ascending" and one with order="descending" as literal values. -
R trim function in xsl and concatenate problem
Hi,
I have a situation where i need to trim the spaces on right side of the element content using XSL.
Please see the following xml.
<BookStore>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<Title>Book Name1 </Title>
<Title>Book Name2</Title>
<Title> Book Name3 </Title>
<Title> Book Name4</Title>
</BookStore>
I need to trim the space on the right side of the title element and need to add a + sign at the end of the each title and then need to concatenate them into a single element "booknames."
That means the booknames should contain value of
<booknames>Book Name1+Book Name2+ Book Name+Book Name4</booknames>
Finally the above xml should look like,
<BookStore>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<booknames>Book Name1+Book Name2+ Book Name+Book Name4</booknames>
</BookStore>
I know we have a normalize function in xsl. But we don't have a rtrim function in xsl. And the difficulty over here is we should read the title element in recursion and them trim space and then add+ then concatenate.
can anyone guide me how to go about it in trimming the space in recursion.
Thanks.Hi,
I have a situation where i need to trim the spaces on right side of the element content using XSL.
Please see the following xml.
<BookStore>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<Title>Book Name1 </Title>
<Title>Book Name2</Title>
<Title> Book Name3 </Title>
<Title> Book Name4</Title>
</BookStore>
I need to trim the space on the right side of the title element and need to add a + sign at the end of the each title and then need to concatenate them into a single element "booknames."
That means the booknames should contain value of
<booknames>Book Name1+Book Name2+ Book Name+Book Name4</booknames>
Finally the above xml should look like,
<BookStore>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<booknames>Book Name1+Book Name2+ Book Name+Book Name4</booknames>
</BookStore>
I know we have a normalize function in xsl. But we don't have a rtrim function in xsl. And the difficulty over here is we should read the title element in recursion and them trim space and then add+ then concatenate.
can anyone guide me how to go about it in trimming the space in recursion.
Thanks. -
Xsl:sort order parameter
Does the oracle xml parser support this syntax (works with Xalan)
<xsl:sort order="{$order}" select="sortnode" />
I need to parameterize the order="ascending/descending". I am sucessfully passing in my parameter (I can output it with <xsl:value-of select="$order"/>), but it doesn't seem to have any effect on the actual sorting.This is Bug 1798018. It was supposed to be fixed in 9.0.2C, but
I just retested it and the problem still persists.
The order and data-type attributes of <xsl:sort> don't
behave properly as Attribute Value Templates. -
This question is related to xsl rathar than java/xml. I would really appreciate if someone could help. The xml document I use is something like this below.
<Performance>
<SortInfo>
<Column>CompletedMeasurement/VinCount</Column>
<Order>TRUE</Order>
</SortInfo>
<PerformanceVO>
<CompletedMeasurement>
<VinCount>35881</VinCount>
</CompletedMeasurement>
</PerformanceVO>
<PerformanceVO>
<CompletedMeasurement>
<VinCount>45077</VinCount>
</CompletedMeasurement>
</PerformanceVO>
</Performance>I have a requirement to use xsl:sort on the xsl to sort this xml document. The sort does not work if use an xsl variable. This is my xsl variable declaration:
<xsl:variable name="sortColumn" select="/Performance/SortInfo/Column"/>
This sort works (note that I have NOT used any xsl variable
<xsl:for-each select="PerformanceVO">
<xsl:sort data-type="number" select="CompletedMeasurement/VinCount" order="ascending"/>
</xsl:for-each>
This sort DOES NOT work (used xsl variable in xsl:sort)
<xsl:for-each select="PerformanceVO">
<xsl:sort data-type="number" select="$sortColumn" order="ascending"/>
</xsl:for-each>This question is related to xsl rathar than java/xml.Then it would be better if you asked it in a place where experts in XSL answer questions. Check out the Mulberry mail-list.
This sort DOES NOT work (used xsl variable in xsl:sort)
<xsl:for-each select="PerformanceVO">
<xsl:sort data-type="number" select="$sortColumn"
order="ascending"/>
</xsl:for-each> I am pretty sure that must be an XSLT FAQ. I haven't looked but I bet you will find it in Dave Pawson's FAQs. -
Format-dateTime function in xsl
Hi,
I am trying to convert String format to specific date time format(YYYY-MM-DD HH24:MI:SS:FF).
I am using below function in xsl:
<xsl:value-of select='xpath20:format-dateTime(/ns0:Transmission/ns0:TransmissionBody/ns0:GLogXMLElement/ns0:ShipmentStatus/ns0:EventDt/ns0:GLogDate,"[Y0001][M01][D01][H01][m01][s01]")'/>
But it is not returning any value.
Source format is String(value= 20101020155400).
Target is dateTime(Expected Value= 2010-10-20 01:55:40.0).
Any suggestions will be helpful.
ThanksHi Arik....
At last i got it. :)
Followed the below steps.
Step1:
Created a String variable "currentDateTimeValue" in BPEL.
Step2:
I have used the below code in JavaEmbedding in BPEL.
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat();
//Date Pattern looks lil weird. But some Web service accepts only this format.
sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'-00:00'");//2012-04-14T16:24:00.578-00:00
String formattedDate = sdf.format(new java.util.Date());
addAuditTrailEntry("Formatted datetime string is: " + formattedDate);
setVariableData("currentDateTimeValue", formattedDate);
Step3:
Created a Simple XSD with an element "DateElement" of String type.
Step4:
Assigned "currentDateTimeValue" value to "DateElement" element, in Assign activity.
Step5:
Now added this DateElement in Transformation activity, as a second source variable. Mapped this data to the required target element in my XSL.
uh-huh I got the output...
Thanks a ton ARIK :D u r really helpful...
Regards,
Sudheer
Maybe you are looking for
-
I have a text overlay which is one line long. when I swap the cast member with another text that wraps to a second line, the text on two lines is squished to the same height as the orignal text. It looks like it is trying to fit the wrapped text into
-
What are points and levels?
Hello, I dont understand what "points" and "levels" are on the apple discussions site? can someone explain
-
"Startup Disk Full" though i have 382GB available on my hard drive?
I regularly get a pop up requesting that I force quit applications due to my startup disk being full, with no more room for application memory (or something similar). It has been popping up more and more frequently in the last couple of days, and it
-
Begining with a virgin system.
Hi Experts, I am really junior with BW. I have working in a project for two months filling infoObjects and infoCubes, creating precess chains and reporting. But i know nothing about modeling the initial infocubes and preparing the system from the beg
-
Software Installation Problems with Media Source and Nomad Explo
Hello Creative Users, recently I had to reinstall my operating system on the PC. I have an IBM Thinkpad R30 with a Sitecom USB2.0 pccard. I am running WinXP Pro SP2 with all latest updates. I have a Nomad Jukebox Zen Xtra with Firmware .20.08 and an