Maintaining the space between elements in the xslt file

Running on 11 GR 1 material...

Try running an xslt to output html... transformation and the transformation deletes the space between my 2 items... (the space between John and Smith is removed)
SELECT XMLSERIALIZE (
          CONTENT XMLTRANSFORM (
                     xmltype (
                        '<data><column name = "USER_FNAME">John</column><column name = "USER_LNAME">Smith</column></data>'),
                     xmltype (
                        '<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<p>
Hello <xsl:value-of select="/data/column[@name=''USER_FNAME'']"/> <xsl:value-of select="/data/column[@name=''USER_LNAME'']"/></p>
</body></html>
</xsl:template>
</xsl:stylesheet>')) AS CLOB)
  FROM DUAL;
Outputs:
<html><body><p>
Hello JohnSmith</p></body></html>
What I've read, this is the standard behavior... the only thing I could do to get this working was to add an xsl: Text with XML: Space = "preserve".
SELECT XMLSERIALIZE (
          CONTENT XMLTRANSFORM (
                     xmltype (
                        '<data><column name = "USER_FNAME">John</column><column name = "USER_LNAME">Smith</column></data>'),
                     xmltype (
                        '<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<p>
Hello <xsl:value-of select="/data/column[@name=''USER_FNAME'']"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="/data/column[@name=''USER_LNAME'']"/></p>
</body></html>
</xsl:template>
</xsl:stylesheet>')) AS CLOB)
  FROM DUAL;
Part of the problem is I am also generate the xslt of the model user seizures... user enters the code for creating simple templates, I run it through various regexes to generate an XSLT that... before you run the XSLT on xml data.

Example:
<p>Hello {{USER_FNAME}} {{USER_LNAME}}</p>
This snippet is entered by a user and transformed in the xslt above... It seems to have to replace all the white spaces with xsl elements: Text empty a little problematic... I was wondering if there is a more elegant solution?

Thanks for the help and advice!

Hi Jason,

From what I understand, the problem is not about properly return a space in a document of XSLT (there are several way to do in fact), but rather on the creation of the XSL piece out of the model defined by the user.
OP use a search and replace on tags custom in the model, so there maybe is complicated on the mixed complex content.

Tags: Oracle Development

Similar Questions

  • How to find the number of days between 2 date elements in the XSLT file

    Hello

    I need to calculate the number of days between 2 date elements (type xs: date). Can you please direct me as to how I can do the same thing.

    I work in 11g and using XSLT 1.0. I tried several options but yet to get a solution for this. I think that this can be done also using XSLT 2.0, but who has not worked for me.

    Can someone please help with this problem, thanks in advance!

    Thank you
    Anju

    Hello

    Have you seen this message?
    Re: Get the Date difference between 2 values of date in days

    You can do in the XSLT file since the dates are in ISO 8601 format.
    http://www.w3.org/TR/NOTE-datetime

    Here is a sample XSLT...

    
    
    
    
    
    
    
    

    The XSLT above will result in * 4 * for the next entry...

    
    2012-01-11T00:00:00.000-05:00
    2012-01-15T00:00:00.000-05:00
    
    

    You can test this example here...
    http://xslttest.appspot.com/

    I hope this helps...

    See you soon,.
    Vlad

    It is considered good etiquette to the answerers rewards with points (as "useful" - 5 pts - or 'correct' - 10pts)
    https://forums.Oracle.com/forums/Ann.jspa?annID=893

  • Carriage returns in the HTML Code, creating additional spaces between elements

    I looked everywhere online and cannot find the solution to my problem. I found several pages explaining a similar event, but no solution.

    When you put several divs side by side, I would like to visually display the code as a div by line: (see image) to do this, I have to use returns in my code (this method makes editing much easier visually). But doing so adds an extra space between the divs that turns a game of 3 columns of thumbnails to 2 columns. I can fix it if I adjust the physical margins between the divs, but this isn't the only solution.

    with-carriage-returns.jpg

    The other difficulty is that if I put the code back to back to back (see picture): what makes the div behave and appear as they should, but now the code is a Visual disorder because it is very crowded.

    no-carriage-returns.jpg

    What I want is to be able to use as many carriage returns in my code and for browsers to ignore these types of line breaks in the code. So, basically, how can I get away from these extra spaces when you use returns in the code?

    I think that your two pages have a missing at the end somewhere.

    OPPS... it happened when I was stripping down the page to create a working example of my question. I set the div missing and re-uploaded both pages. The problem is still there.

    Change display: inline; float: left; and add margin: 0 0 4px 4px; (as shown below)

    I had already tried to use floats, but something else in the code forced the columns to 2 instead of 3.

    'Apply Source Formatting' did you use?

    I use that religiously. I'm quite anal about visually clean code.

    Well, I just fixed the problem while responding... funny... I removed the margins of the element img real (.imageThumb img) and placed on the div that surrounds the img (.imageThumb). I also reapply the float. Thank you all for the help - it helped me rethink. But I could have sworn I had once placed the margins on .imageThumb before and it didn't work.

    {.imageThumb}

    Width: 100px;

    height: 75px;

    display: inline;

    float: left;

    margin: 0px 10px 10px 0px;

    cursor: pointer;

    }

    .imageThumb img {}

    / * margin: 0px 10px 10px 0px; * /

    }

  • How generations for db in the XSLT file sequence number

    Hello gurus SOA,.

    I have a requirement, please see below

    I am using SOA 11.1.1.6

    Insert a webservice to db, XSLT call, I have 10 items next to the source and 11 items next to the target.

    • Source to target first 10 mappings are performed.
    • Now the requirement is, for the 11th element target we must pass a sequence number to the database targeted, means-(sequence number must be generated for each execution of the XSLT execution)

    How do the last point?

    Can someone help me please

    Hello

    You can pass the sequence number in the 11th element to help. "oraext:sequence-next-val("Sequence name as a string", "Datasource as a string") function.

    Kind regards

    Anshul


  • For each does not properly in the XSLT file to two loops on a single node

    Hi all

    I'm transforming 2 inputs to a single target using XSLT. Both of the target entry of the same pattern and have the child element.
    In the XSLT, I gave this condition.
    "< xsl: for each select="$Variable1.payload/ns1:BookStore/ns1:Books ">
    < xsl: for-each select = "/ ns1:BookStore / ns1:Books" >
    "< xsl: if test="$Variable1.payload/ns1:BookStore/ns1:Books/ns3:BookId = ns3:Books / ns3:BookId ">

    My second for each does not work and in the target, I'm getting double elements. Help, please. Here are two xml source and xml desired target.
    1 XML source:

    < bookStore >
    < book >
    Name1 < name > < / name >
    author1 < author > < / author >
    < ID > 1 < / BookId >
    < quantity > 2 < / quantity >
    < price > < price / >
    < status > < / status >
    < book >
    < book >
    name2 < name > < / name >
    Author2 < author > < / author >
    < ID > 2 < / BookId >
    < quantity > 2 < / quantity >
    < price > < price / >
    < status > < / status >
    < book >
    < book >
    < name > NAME3 < / name >
    author of 3 < author > < / author >
    < ID > 3 < / BookId >
    < quantity > 2 < / quantity >
    < price > < price / >
    < status > < / status >
    < book >
    < / book >

    XML source 2:

    < bookStore >
    < book >
    < name > < / name >
    < author > < / author >
    < quantity > < / quantity >
    < ID > 1 < / BookId >
    < price > 100 < / price >
    < status > < / status >
    < book >
    < book >
    < name > < / name >
    < author > < / author >
    < quantity > < / quantity >
    < ID > 2 < / BookId >
    < price > 200 < / price >
    < status > NA < / status >
    < book >
    < book >
    < name > < / name >
    < author > < / author >
    < quantity > < / quantity >
    < ID > 3 < / BookId >
    < price > 300 < / price >
    < status > < / status >
    < book >
    < / book >

    Desired target XML:

    < bookStore >
    < book >
    Name1 < name > < / name >
    author1 < author > < / author >
    < ID > 1 < / BookId >
    < quantity > 2 < / quantity >
    < price > 100 < / price >
    < status > < / status >
    < book >
    < book >
    name2 < name > < / name >
    Author2 < author > < / author >
    < ID > 2 < / BookId >
    < quantity > 2 < / quantity >
    < price > 200 < / price >
    < status > NA < / status >
    < book >
    < book >
    < name > NAME3 < / name >
    author of 3 < author > < / author >
    < ID > 3 < / BookId >
    < quantity > 2 < / quantity >
    < price > 300 < / price >
    < status > < / status >
    < book >
    < / book >

    Thank you

    Hello

    It will not work like that... To do something like the following... Only one for each...

    
      
      
        ns1:Name
        ns1:Author
        ns1:BookId
        $Variable1.payload/ns1:BookStore/ns1:Books[ns1:BookId = $bookId]/Quantity
        $Variable1.payload/ns1:BookStore/ns1:Books[ns1:BookId = $bookId]/Price
        $Variable1.payload/ns1:BookStore/ns1:Books[ns1:BookId = $bookId]/Status
      
    
    

    I don't have to check the syntax, but you get the idea...

    I hope this helps...

    See you soon,.
    Vlad

  • Attributes of hard code in the xslt file

    Hello

    I try to hardcode the attributes in the XSLT using setText, but during the execution, the attributes have the value null.

    Is not the right way to hardcode the attributes in the XSLT?

    Thank you!

    solved the problem by using the assign activity.

  • How to call a value of preference in the XSLT file

    Hi all

    How to call a value preference (which is defined in bpel already) in the XSLT?

    Can someone help me please

    Kind regards

    Villeneuve ch

    Get the value of preference and and check out the post below to pass as a parameter

    http://www.albinsblog.com/2012/07/passing-parameter-to-XSLT-in-SOA-11g.html#.UjfqfMZmiSo

    Concerning

    Albin I

  • Automatic update Windows maintains the same file.

    Windows Update wants to update the same file KB954430 says there sucsessful it made 12 times but she always wants to do a date put all suggestions?

    Hello

    Control Panel - Windows Updates - right click on and HIDE.

    You can also run these to restore updates.

    How to reset the Windows Update components? -a Mr Fixit
    http://support.Microsoft.com/kb/971058

    Description of the system for Windows Vista, Windows Server 2008, update tool and
    for Windows 7
    http://support.Microsoft.com/kb/947821

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • How to have some default values in all the elements that are empty in the xslt file.

    Hello

    Need help:

    Scenario:

    After transformation .xslt, there are certain elements that are mapped but left empty. I want to give him some defaults as '0'. How to do this.

    Thank you.

    you could do this:

    http://StackOverflow.com/questions/2791295/setting-default-values-for-empty-nodes

    and if you want different default values for some nodes to which you may use local-name and some other default settings listed

  • Need help in the XSLT file

    Hello

    Need help to come up with a construction xsl. Am using SOA 11.1.1.5. I have the underside of the input samples

    < root element >

    < location >

    < Location_id > Location_ID10 < / location_id >

    < Location_Code > Location_Code11 < / Location_Code >

    State12 < of State > < / State >

    < / location >

    < location >

    < Location_id > Location_ID13 < / location_id >

    < Location_Code > Location_Code14 < / Location_Code >

    State12 < of State > < / State >

    < / location >

    < location >

    < Location_id > Location_ID16 < / location_id >

    < Location_Code > Location_Code17 < / Location_Code >

    State18 < of State > < / State >

    < / location >

    < location >

    < Location_id > Location_ID91 < / location_id >

    < Location_Code > Location_Code91 < / Location_Code >

    State19 < of State > < / State >

    < / location >

    < location >

    < Location_id > Location_ID92 < / location_id >

    < Location_Code > Location_Code92 < / Location_Code >

    State19 < of State > < / State >

    < / location >

    < / root >

    Here is what I tried for expected output

    < ns0:root >

    < ns0:Categories >

    < ns0:Category >

    < ns0:CategoryValue >

    < ns0:CategoryValue >

    < ns0:Name > visits12 < / ns0:Name >

    < ns0:Code > visits12 < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID10 < / ns0:Name >

    < ns0:Code > Location_Code11 < / ns0:Code >

    < / ns0:CategoryValue >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID13 < / ns0:Name >

    < ns0:Code > Location_Code14 < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < ns0:CategoryValue >

    State18 < ns0:Name > < / ns0:Name >

    State18 < ns0:Code > < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID16 < / ns0:Name >

    < ns0:Code > Location_Code17 < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < ns0:CategoryValue >

    < ns0:Name > State19 < / ns0:Name >

    < ns0:Code > State19 < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID91 < / ns0:Name >

    < ns0:Code > Location_Code92 < / ns0:Code >

    < / ns0:CategoryValue >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID91 < / ns0:Name >

    < ns0:Code > Location_Code92 < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < / ns0:Category >

    < / ns0:Categories >

    < / ns0:root >

    But here's what I mean I know there is a problem with xslt, but I'm hard to fix if need help

    < ns0:root >

    < ns0:Categories >

    < ns0:Category >

    < ns0:CategoryValue >

    < ns0:CategoryValue >

    < ns0:Name > visits12 < / ns0:Name >

    < ns0:Code > visits12 < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID10 < / ns0:Name >

    < ns0:Code > Location_Code11 < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < ns0:CategoryValue >

    State18 < ns0:Name > < / ns0:Name >

    State18 < ns0:Code > < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID16 < / ns0:Name >

    < ns0:Code > Location_Code17 < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < ns0:CategoryValue >

    < ns0:Name > State19 < / ns0:Name >

    < ns0:Code > State19 < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name > Location_ID91 < / ns0:Name >

    < ns0:Code > Location_Code91 < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < / ns0:Category >

    < / ns0:Categories >

    < / ns0:root >

    It is ignored if the previous value same as current as if the previous value even running as I want to nest under the same node, as shown above in the expected results.

    Here's xslt I have so far

    ................

    ...........................

    ......

    < xsl: template match = "/" >

    < ns0:root >

    < ns0:Categories >

    < ns0:Category >

    < ns0:CategoryValue >

    < xsl: for-each select = "/ tns:Root - element / tns:Location [not (previous - sibling:tns:Location / tns: State = tns: State)]" >

    < ns0:CategoryValue >

    < ns0:Name >

    < xsl: value-of select = "tns: State" / >

    < / ns0:Name >

    < ns0:Code >

    < xsl: value-of select = "tns: State" / >

    < / ns0:Code >

    < ns0:CategoryValue >

    < ns0:Name >

    < xsl: value-of select = "tns:Location_ID" / >

    < / ns0:Name >

    < ns0:Code >

    < xsl: value-of select = "tns:Location_Code" / >

    < / ns0:Code >

    < / ns0:CategoryValue >

    < / ns0:CategoryValue >

    < / xsl: foreach >

    < / ns0:CategoryValue >

    < / ns0:Category >

    < / ns0:Categories >

    < / ns0:root >

    < / xsl: template >

    < / xsl: stylesheet >

    Thank you.

    You use xslt-style in this kind of case of grouping:

    Try just below xslt:

    http://www.w3.org/1999/XSL/transform.

    xmlns:ns0 = "France" >

    'State' >

    Please answer if it works for you.

  • Problem using the command oraext:query-database() in the xslt file

    Hello

    I ask a function through the query command - database () in a certain xslt in a BPEL process as below:

    < name of xsl: variable = "Company" >

    < xsl: value - of select = "string ('CORPORATION')" / >

    < / xsl: variable >

    < name of xsl: variable = "CustAccIdFrmDB" >

    < xsl: value-of select ='orext:query - database (concat ("select xx_egytrans_integration.get_xid(",$getCustAccID,",",$Corporation,") from the dual"), false (), false (), string("jdbc/otmdatasource")) "/ >"

    < / xsl: variable >

    But, after the deployment of the BPEL process and when running it, I get the error at run time.

    Here is the error,

    " < bpelFault > < faultType > 0 < / faultType > < subLanguageExecutionFault xmlns =" http://schemas.Oracle.com/BPEL/extension "> < a name ="summary"part > < summary > XPath expression cannot run." An error occurs during the processing of the XPath expression; the term is ora: OutputVariable.OutputParameters). the XPath expression cannot run; the reason was: javax.xml.transform.TransformerException: XML-22900: (Fatal Error) an internal error condition has occurred. Check the detailed origin described in the text of the exception message and verify that the XPath query is correct. < Summary / > < / part > < part name = "code" > < code > XPathExecutionError < / code > < / piece > < / subLanguageExecutionFault > < / bpelFault >


    Could if it you please let me know the probable reason for the error? Please help as soon as possible.


    Thank you

    Imane

    Hello

    The problem is now solved by adding an alias for the columns like below:

    Select xx_egytrans_integration.get_xid (21468, 'CORPORATION') result of double;

    Now, it could be used in xsl.

    Thank you

    Imane.

  • using the xslt file import

    I have several XSLT stylesheets to generate PDF documents for each modules. These XSLT all use the same models (functions) for data formatting. I love having these models all in a single file to be imported / included in the specific XSLT modules. I can not the right way to import, xsl language are both located in the same folder.

    So far, I have:

    * & lt; xsl: import href = "file:CommonFunctions.xsl" / > * "

    I used the line above with and without the file, the path and everything else I could think of.

    The only way I can get this to work is to appoint the full path like this:

    * & lt; ' xsl: import href="file:D:\projects\toolA\include\templates\CommonFunctions.xsl" / >. *

    but this is not portable to other servers.

    Can someone clarify which way I have to use?

    Generally speaking, relative paths for web applications are specified against the of the web application that you use if you can try that.

  • Issue of conversion from string to DateTime to subtract the duration of 1 day in the XSLT file

    Hello

    I need to subtract the duration 1 day after the date of entry which is in the format "yyyy-mm - ddT00:00:00"(data type = String)
    I tried to use the available function: subtract-dayTimeDuration-from - dateTime () but this function expects the entry in the datetime data type and so on use of this I get Null as the result of the transformation.

    I used to convert the input string, dateTime() but it doesn't seem to work because I get the error "Invalid Xpath expression (null).

    Please help identify any other way I can convert the string to dateTime format and then subtract the duration. Or another way to subtract the length of the day 1 of the string itself.

    Thanks for the help!

    Hello

    It should work with the date in the format that you have... Look at the code, there may be a typing error... In addition, in BPEL, you must use the xp20 functions...

    Take a look at this...
    https://blogs.Oracle.com/Reynolds/entry/whats_the_time_mr_bpel

    I hope this helps...

    See you soon,.
    Vlad

  • function of database in the xslt file

    Hello

    I followed the link below

    http://Neeraj-SOA-tips.blogspot.com/2011/04/getting-XML-output-from-oraextquery.html

    and I'm able to get several lines of this function, but when I copy the data variable to another variable, the value is empty and I'm getting the fault of null value. Looks like it's the problem with namespace. Someone at - he already tried this before?

    Thank you.

    Hi OracleSOAFM,

    It is possible to create a variable without namespace. I have created a new schema and creates a new variable of it after the removal of the namespace of the schema. Your variable is already created or you try again with a new scheme?

    Would also be useful if you let us know what SOA version you are using.

    Kind regards
    Neeraj Sehgal

  • ORA: getPreference in an xslt file to transform the activity as input.

    Hello
    We have the following situation:

    We send input to a system fields target via a transformation (xslt) the value is '01486 '. We want to use an ora:getPreference('myPrefSecurityCode') to add the field to the plan of the configuration when we deploy the process. Because the field will change to test environment for the prod environment.

    "I assigned the ora:getPreference('myPrefSecurityCode') to a variable of type string named ' < SubscriberCode > < SubscriberCode xmlns =" "" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:ns = "http://www.w3.org/2001/XMLSchema" xsi: type = "ns:string" > 01486 < / SubscriberCode > < / SubscriberCode >.
    As you can see above, the field is assigned without any problem.


    But when I try to assign the field in a Transform (xslt), I get the following error:


    < bpelFault > < faultType > 0 < / faultType > < selectionFailure xmlns = "http://schemas.xmlsoap.org/ws/2003/03/business-process/" > < a name = "summary" part > < summary > query string XPath returns zero node.
    The activity assign the query node returns zero node.
    Either the data node or in the node xpath query was invalid.
    According to BPEL4WS 1.1 spec section 14.3, check the value of line number 371 node in the BPEL source.
    < / Summary > < / piece > < / selectionFailure > < / bpelFault >

    Edited by: 849200 29/04/2013 06:43

    Hello

    To pass the values of variables in the XSLT file, create an element in one of the schema of the source of your XSLT.
    Use an action entitled before this transformation, and assigns the value of var preferably to the newly created variable.
    Use this value to the variable to map to the required target node.

    I hope this helps.

    Kind regards
    Karan
    http://learn-oraclesoa.blogspot.com/

Maybe you are looking for