From: Oleg T. <he...@us...> - 2005-10-16 20:13:25
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests Added Files: availability.xslt invoice-processor.xsl invoice.xml regexp-match-test.xslt test.xml Log Message: --- NEW FILE: invoice-processor.xsl --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl"> <xsl:template match="/"> <!-- Main result document - confirmation --> <html> <head> <title>Thank you for purchasing!</title> </head> <body> <h2>Thank you for purchasing at fabrikam.com!</h2> </body> <xsl:apply-templates mode="order"/> </html> </xsl:template> <xsl:template match="invoice" mode="order"> <!-- Additional result document - SOAP message for fabrikam.com order processing web service --> <exsl:document href="soap/order.xml" indent="yes"> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns:Order xmlns:ns="urn:fabrikam-com:orders"> <xsl:apply-templates mode="order"/> </ns:Order> </soap:Body> </soap:Envelope> </exsl:document> </xsl:template> <xsl:template match="item" mode="order"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> --- NEW FILE: test.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="D:\projects\EXSLT.NET\ExsltTest\tests\availability.xslt"?> <root> </root> --- NEW FILE: availability.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:date="http://exslt.org/dates-and-times" xmlns:math="http://exslt.org/math" xmlns:random="http://exslt.org/random" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:set="http://exslt.org/sets" xmlns:str="http://exslt.org/strings" xmlns:date2="http://gotdotnet.com/exslt/dates-and-times" xmlns:math2="http://gotdotnet.com/exslt/math" xmlns:regexp2="http://gotdotnet.com/exslt/regular-expressions" xmlns:set2="http://gotdotnet.com/exslt/sets" xmlns:str2="http://gotdotnet.com/exslt/strings" xmlns:dyn2="http://gotdotnet.com/exslt/dynamic" exclude-result-prefixes="exsl date math regexp set str date2 math2 regexp2 set2 random dyn2"> <xsl:template match="/"> <html> <head> <title>EXSLT.NET regression test - functions availability</title> </head> <body> <h3>EXSLT.NET regression test - functions availability</h3> <xsl:apply-templates select="document('../../../doc/Functions.xml')/*/module"/> </body> </html> </xsl:template> <xsl:template match="module"> <p> <h4><xsl:if test="@is-exslt-module='yes'">EXSLT: </xsl:if> <xsl:value-of select="@name"/></h4> <table border="1" width="100%"> <tr> <th>Function name</th> <th>Availability</th> </tr> <xsl:apply-templates select="function"/> </table> </p> </xsl:template> <xsl:template match="function"> <tr> <xsl:variable name="fn" select="concat(../@prefix, ':', @name)"/> <td><xsl:value-of select="$fn"/></td> <td align="center"> <xsl:choose> <xsl:when test="function-available($fn)"> <span style="color:green">Ok</span> </xsl:when> <xsl:otherwise> <span style="color:red">Not available</span> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:template> </xsl:stylesheet> --- NEW FILE: regexp-match-test.xslt --- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:regexp="http://exslt.org/regular-expressions"> <xsl:template match="/"> -------------------------------------------------------------------- Test 1, expected results: Part 1 = http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml Part 2 = http Part 3 = www.bayes.co.uk Part 4 = Part 5 = /xml/index.xml?/xml/utils/rechecker.xml Results: <xsl:for-each select="regexp:match('http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml', '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 2, expected results: Part 1 = This Part 2 = is Part 3 = a Part 4 = test Part 5 = string Results: <xsl:for-each select="regexp:match('This is a test string', '(\w+)', 'g')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 3, expected results: Part 1 = his Part 2 = is Part 3 = a Part 4 = test Results: <xsl:for-each select="regexp:match('This is a test string', '([a-z])+ ', 'g')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 4, expected results: Part 1 = This Part 2 = is Part 3 = a Part 4 = test Results: <xsl:for-each select="regexp:match('This is a test string', '([a-z])+ ', 'gi')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 5, expected results: Part 1 = 22/12/2003 21:00 AcmeService DB updated Part 2 = 22/12/2003 Part 3 = 21:00 Part 4 = AcmeService Part 5 = DB updated Results: <xsl:for-each select="regexp:match ('22/12/2003 21:00 AcmeService DB updated', '(\d{1,2}/\d{1,2}/\d{4})\s+(\d{2}:\d{2})\s+(\w*)\s+(.*)')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> </xsl:template> </xsl:stylesheet> --- NEW FILE: invoice.xml --- <invoice> <item>Wallabee</item> <item>Wombat</item> <item>Wren</item> </invoice> |