Tag: xslt
XPath String Operators and Functions
XPath 1.0 have many string functions:
concat(string string1, string string2, …)— This function returns all strings you pass to it concatenated (that is, joined) together.
contains(string string1, string string2)— This function returns true if the first string contains the second one.
normalize-space(string string1)— This function returns string1 after leading and trailing whitespace is stripped and multiple consecutive whitespace [...]
Posted: August 12th, 2008 under BizTalk.
Tags: BizTalk, xslt
Comments: none
xsl to find whether a string starts with a word in the element
I have a xml sample file generated from the schema.
<ns0:PurchaseOrder xmlns:ns0=”http://yourprojectname.Schemas.PO”>
<PONumber>PONumber_0</PONumber>
<PODate>1999-05-31</PODate>
<POQty>POQty_0</POQty>
<Customer>
<Name1>BiztalkServerGuide</Name1>
</Customer>
</ns0:PurchaseOrder>
now, in order to find a specific string in the element , you need to place the below code in the buffer are of the inline XSLT call template
<xsl:template name=”AnyNameofYourChoice” match=”//*[starts-with(/*[local-name()='PurchaseOrder' and namespace-uri()='http://yourprojectname.Schemas.PO']/*[local-name()='Customer' and namespace-uri()='']/*[local-name()='Name1' and namespace-uri()=''], ‘Biz‘)]”>
<xsl:element name=”startsWithBiz”>
“starts with Biz”
</xsl:element>
</xsl:template>
Thanks
Posted: August 1st, 2008 under BizTalk.
Tags: BizTalk, xsl, xslt
Comments: none
xsl to find a specific string in the element
I have a xml sample file generated from the schema.
<ns0:PurchaseOrder xmlns:ns0=”http://yourprojectname.Schemas.PO”>
<PONumber>PONumber_0</PONumber>
<PODate>1999-05-31</PODate>
<POQty>POQty_0</POQty>
<Customer>
<Name1>BiztalkServerGuide</Name1>
</Customer>
</ns0:PurchaseOrder>
now, in order to find a specific string in the element , you need to place the below code in the buffer are of the inline XSLT call template
<xsl:template name=”AnyNameofYourChoice” match=”//*[contains(/*[local-name()='PurchaseOrder' and namespace-uri()='http://yourprojectname.Schemas.PO']/*[local-name()='Customer' and namespace-uri()='']/*[local-name()='Name1' and namespace-uri()=''], ‘BizTalkServer‘)]”>
<xsl:element name=”containsBiztalkServerGuide”>
“Contains BiztalkServer String”
</xsl:element>
</xsl:template>
Thanks
Posted: July 29th, 2008 under BizTalk.
Tags: BizTalk, call template, mapper, xslt
Comments: none