regex - xslt remove string and special character from number in xml -


during xslt transformation, have tried clean string , special customer number, doesnt work. need remove c: or s: number. :)

xml file 1

<data>  <request>    <custno>c:222</custno>  </request> </data> 

xml file 2

<data>  <request>    <custno>s:333</custno>  </request> </data> 

xslt

        <?xml version="1.0" encoding="iso-8859-1" ?>         <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fo="http://www.w3.org/1999/xsl/format" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" >             <xsl:output method="xml" version="1.0" indent="yes"/>             <xsl:template match="request" >                 <testpayment>                     <transactions>                         <transaction  custno="{custno}" >                                    </transaction>                     </transactions>                 </testpayment>             </xsl:template>              <xsl:template match="request/custno">                     <xsl:value-of select="regex=(^c:[a-za-z0-9]*$,^s:[a-za-z0-9]*$ )"/>              </xsl:template>         </xsl:template>         </xsl:stylesheet> 

result of xml file 1:

    <?xml version="1.0" encoding="utf-8"?>     <testpayment>       <transactions>         <transaction custno="222">         </transaction>       </transactions>     </testpayment> 

result of xml file 2:

    <?xml version="1.0" encoding="utf-8"?>     <testpayment>       <transactions>         <transaction custno="333">         </transaction>       </transactions>     </testpayment> 

why don't try double-translate function?

<transaction custno="{translate(custno, translate(custno, '0123456789', ''), '')}" > 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -