简体   繁体   中英

XSLT2.0 issue in Concatenation sequence

I am trying to do concat of 3 strings:

Input XML:

<Data>
    <LExpenseType> Hotel</LExpenseType>
    <VendorName> Beatel Hotel </VendorName>
    <LDescription> Business trip </LDescription>
</Data>

My XSLT Logic:

<tns:description>
 <xsl:value-of select="LExpenseType[node()]|VendorName[node()]|LDescription[node()]" separator=","/>
 </tns:description>

My expectation is : all three values should be returned in sequence with a comma , as delimiter; but they are not returned in order.

Please help with this.

Don't use the union operator | then as it orders its nodes in document order, simply use a comma to construct your sequence with eg <xsl:value-of select="LExpenseType[node()], VendorName[node()], LDescription[node()]" separator=","/> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM