Field Service

Get Involved. Join the Conversation.

Topic

    Adam
    Regular Expression and XSLT TransformationAnswered
    Topic posted December 11, 2018 by AdamBronze Medal: 1,250+ Points, tagged Configuration 
    52 Views, 6 Comments
    Title:
    Regular Expression and XSLT Transformation
    Summary:
    Properties > Regular Expression and XSLT Transformation
    Content:

    Please can any expert give an example of Custom Property regular expression and XSLT transformation sample code that create html table based on the property value?

    Thanks

    Version:
    18D

    Best Comment

    Adam

    I got it fixed.

    Thanks

    Comment

     

    • Adam

      I am trying to work with example given in the following thread:

      http://communities.rightnow.com/posts/ca391f6011?commentId=72247#72247

      But all the text is being printed as is. PFA screenshot.

       

    • Adam

      I got it fixed.

      Thanks

    • Hardik Gupta

      Hi Adam,

      Can you please share with the community?

    • Adam

      This is my xslt fine:

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
      <html> 
          <body>
          <h2></h2>
          <table border="1">
              <tr bgcolor="#41c1f4">
                  <th>Service Item Name</th>
                  <th>Unit #</th>
                  <th>Quoted Quantity</th>
                  <th>Unit of Measure</th>
      <th>Rate</th>
      <th>Quoted Price</th>
      <th>Actual Quantity</th>
      <th>Actual Price</th>
              </tr>
              <xsl:for-each select="catalog/cd">
              <tr>
                  <td style="text-align:center"><xsl:value-of select="name"/></td>
                  <td style="text-align:center"><xsl:value-of select="unitNum"/></td>
                  <td style="text-align:center"><xsl:value-of select="quotedQ"/></td>
      <td style="text-align:center"><xsl:value-of select="uom"/></td>
      <td style="text-align:center"><xsl:value-of select="Rate"/></td>
      <td style="text-align:center"><xsl:value-of select="quotedP"/></td>
      <td style="text-align:center"><xsl:value-of select="actualQ"/></td>
      <td style="text-align:center"><xsl:value-of select="ActualP"/></td>            
              </tr>
              </xsl:for-each>
          </table>
          </body>
          </html>
      </xsl:template>
      </xsl:stylesheet>
       
      And this is the payload value:
      <catalog> <cd><name>Disposition</name><unit>1151, Hydrovac</unit><quotedQ>1</quotedQ><actualQ></actualQ><uom>Hour</uom><rate>285</rate><quotedP>285</quotedP><actualP></actualP></cd></catalog>

       

    • Madhumitha Thinakaran

      Hi Adam,

      Could you please tell for what usecase you have used regular expression.

      Thanks,

      Madhu

      • Adam

        I did not use regular expression yet. But in a general concept regular expressions are used for the data validation. If you can list your use case then experts will help you out. BTW i am not an expert : ) I am referring to Zsolt.