在字符后修改XSLT中的字符串

时间:2014-06-16 11:37:17

标签: xml xslt

我有一个xslt用于此数据Feed。我需要能够删除在?之后发生的landingPage中的所有字符。有人可以帮我开始吗?

由于

<StyleAPI>
<styles>
    <style>
        <brand>Nike</brand>
        <categoryId>9</categoryId>
        <categoryName>Apparel</categoryName>
        <defaultImage>http://myntra.myntassets.com/images/style/properties/Nike-Sahara-Team-India-Fanwear-Round-Neck-Jersey_2d27392cc7d7730e8fee0755fd41d30c_images_mini.jpg</defaultImage>
        <description>Blue round neck Sahara Team India jersey, has short sleeves, print on the chest and back chest. Warranty for manufacturing defects: 6 months (not valid on products with more than 20% discount).</description>
        <gender>Men</gender>
        <inventoryStatus>0</inventoryStatus>
        <landingPage>http://www.myntra.com/tshirts/nike/nike-sahara-team-india-fanwear-round-neck-jersey/1163/buy?utm_source=aff-omg&amp;utm_medium=cpa&amp;utm_campaign=data-feed1163</landingPage>
        <price>895.0</price>
        <productDisplayName>Nike Sahara Team India Fanwear Round Neck Jersey</productDisplayName>
        <searchImage>http://myntra.myntassets.com/images/style/style_search_image/Nike-Sahara-Team-India-Fanwear-Round-Neck-Jersey_2d27392cc7d7730e8fee0755fd41d30c_images_180_240.jpg</searchImage>
        <sizesNotAvailable>XXS,XS,S,M,L,XL,XXL,XXXL</sizesNotAvailable>
        <styleId>1163</styleId>
        <subCategoryId>31</subCategoryId>
        <subCategoryName>Topwear</subCategoryName>
        <subSubCategoryId>90</subSubCategoryId>
        <subSubCategoryName>Tshirts</subSubCategoryName>
    </style>

1 个答案:

答案 0 :(得分:1)

使用substring-before(landingPage, '?')获取例如http://www.myntra.com/tshirts/nike/nike-sahara-team-india-fanwear-round-neck-jersey/1163/buy。如果您想在结尾处保留问号,则可以使用concat(substring-before(landingPage, '?'), '?')