Define XSLT File

Define an XSLT transformation file to configure a throttle monitor.

For example, the monitor for a throttle T1 is defined in the XSLT file using a <monitor> tag as follows:

<output>
<xsl:variable name="childnodes">
<xsl:value-of select="$nbRequest/loc:NewOrderReq/count(loc:OrderDtl)"/>
</xsl:variable>
<monitor>
<metricName>T1</metricName>
<metricIncrement><xsl:value-of select="$childnodes"/></metricIncrement>
</monitor>
</output>

In the preceding example, the metricIncrement is assigned based on the count of the OrderDtl element in the payload of an incoming request. If you have an input payload with n number of OrderDtl elements, you can parse the number of OrderDtl elements and assign that number to metricIncrement. The metricIncrement is applied to the throttle configuration.

Note:
  • The throttle monitor defined in the XSLT file must be configured in the Config UI under Monitors tab.
  • You can create multiple monitors in an XSLT file. Each monitor is defined using a separate <monitor> tag.
  • If the XPath formula used in the metricIncrement field returns an invalid value, the content throttle increments the throttle count value by 1, which is the default value.

Example XML (Payload) Files

This section shows the sample XML files which shows payloads with 2 Orderdetails and 4 Orderdetails. Refer to Example XSLT File for the XSLT file for these payloads.

  • Payload with 2 Orderdetails
    <?xml version = "1.0" encoding = "UTF-8"?>
    <NewOrderReq xmlns = "http://www.tibco.com/schemas/TAO/NewOrderSchema-v3.xsd">
    <CustID>11111</CustID>
    <EmailID>user01@edusvr</EmailID>
    <OrderDtl>
       <ProductID>1001</ProductID>
       <ProductDesc>Executive Black Leather Chair</ProductDesc>
       <Qty>1</Qty>
       <UnitPrice>159.99</UnitPrice>
    </OrderDtl>
    <OrderDtl>
       <ProductID>3002</ProductID>
       <ProductDesc>Medium point, black ink pens,50-pk</ProductDesc>
       <Qty>5</Qty>
       <UnitPrice>17.99</UnitPrice>
    </OrderDtl>
    <ShippingDtl>
    <Address>3303 Hillview</Address>
    <City>Palo Alto</City>
    <State>CA</State>
    <Zipcode>94303</Zipcode>
    <Country>USA</Country>
    </ShippingDtl>
    </NewOrderReq>
  • Payload with 4 Orderdetails
    <?xml version = "1.0" encoding = "UTF-8"?>
    <NewOrderReq xmlns = "http://www.tibco.com/schemas/TAO/NewOrderSchema-v3.xsd">
    <CustID>11111</CustID>
    <EmailID>user01@edusvr</EmailID>
    <OrderDtl>
       <ProductID>1001</ProductID>
       <ProductDesc>Executive Black Leather Chair</ProductDesc>
       <Qty>1</Qty>
       <UnitPrice>159.99</UnitPrice>
    </OrderDtl>
    <OrderDtl>
       <ProductID>3002</ProductID>
       <ProductDesc>Medium point, black ink pens,50-pk</ProductDesc>
       <Qty>5</Qty>
       <UnitPrice>17.99</UnitPrice>
    </OrderDtl>
    <OrderDtl>
       <ProductID>3002</ProductID>
       <ProductDesc>Medium point, black ink pens,50-pk</ProductDesc>
       <Qty>5</Qty>
       <UnitPrice>17.99</UnitPrice>
    </OrderDtl>
    <OrderDtl>
       <ProductID>3002</ProductID>
       <ProductDesc>Medium point, black ink pens,50-pk</ProductDesc>
       <Qty>5</Qty>
       <UnitPrice>17.99</UnitPrice>
    </OrderDtl>
    <ShippingDtl>
    <Address>3303 Hillview</Address>
    <City>Palo Alto</City>
    <State>CA</State>
    <Zipcode>94303</Zipcode>
    <Country>USA</Country>
    </ShippingDtl>
    </NewOrderReq>

Example XSLT File

This section shows an example XSLT file which you can use as a reference to create an XSLT file. This XSLT file illustrates how you can use the number of OrderDtl element in a payload.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:loc="http://www.tibco.com/schemas/TAO/NewOrderSchema-v3.xsd">
<xsl:template match="/">
<xsl:variable name="nbRequestHref">
<xsl:value-of select="/transformation/nbRequest/@href"/>
</xsl:variable>
<xsl:variable name="nbRequest">
<xsl:copy-of select="document($nbRequestHref)/soap:Envelope/soap:Body/*"/>
</xsl:variable>
<output>
<xsl:variable name="childnodes">
<xsl:value-of select="$nbRequest/loc:NewOrderReq/count(loc:OrderDtl)"/>
</xsl:variable>
<monitor>
<metricName>T1</metricName>
<metricIncrement><xsl:value-of select="$childnodes"/></metricIncrement>
</monitor>
</output>
</xsl:template>
</xsl:stylesheet>