dmarston 2002/06/07 15:19:37 Added: test/tests/conf/position position99.xsl position100.xsl position101.xml position101.xsl position98.xml position98.xsl position99.xml position100.xml Log: Tests inspired by Bugzilla#9575 Revision Changes Path 1.1 xml-xalan/test/tests/conf/position/position99.xsl Index: position99.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- FileName: position99 --> <!-- Document: http://www.w3.org/TR/xpath --> <!-- DocVersion: 19991116 --> <!-- Section: 2.2 --> <!-- Creator: David Marston --> <!-- Purpose: Test count() starting on an element and going upward. --> <xsl:output method="xml" indent="no" encoding="UTF-8"/> <xsl:template match="/"> <out> <xsl:for-each select="//center"> <xsl:value-of select="count(ancestor-or-self::node())"/><xsl:text> nodes on this axis: </xsl:text> <xsl:apply-templates select="ancestor-or-self::node()" mode="census"/> </xsl:for-each> </out> </xsl:template> <xsl:template match="/" mode="census"> <xsl:text>Root Node </xsl:text> </xsl:template> <xsl:template match="*" mode="census"> <xsl:text>E: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="@*" mode="census"> <xsl:text>A: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="text()|comment()|processing-instruction()" mode="census"> <xsl:text>ERROR! </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> 1.1 xml-xalan/test/tests/conf/position/position100.xsl Index: position100.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- FileName: position100 --> <!-- Document: http://www.w3.org/TR/xpath --> <!-- DocVersion: 19991116 --> <!-- Section: 2.2 --> <!-- Creator: David Marston --> <!-- Purpose: Test count() starting on a text node and going upward. --> <xsl:output method="xml" indent="no" encoding="UTF-8"/> <xsl:template match="/"> <out> <xsl:for-each select="//center/text()[1]"> <xsl:value-of select="count(ancestor-or-self::node())"/><xsl:text> nodes on this axis: </xsl:text> <xsl:apply-templates select="ancestor-or-self::node()" mode="census"/> </xsl:for-each> </out> </xsl:template> <xsl:template match="/" mode="census"> <xsl:text>Root Node </xsl:text> </xsl:template> <xsl:template match="*" mode="census"> <xsl:text>E: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="@*" mode="census"> <xsl:text>A: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="text()" mode="census"> <xsl:text>T: </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="comment()|processing-instruction()" mode="census"> <xsl:text>ERROR! </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> 1.1 xml-xalan/test/tests/conf/position/position101.xml Index: position101.xml =================================================================== <?xml version="1.0"?> <far-north> Level-1 <north-north-west1/> <north-north-west2/> <!-- Comment-2 --> Level-2 <?a-pi pi-2?> <north> <!-- Comment-3 --> Level-3 <?a-pi pi-3?> <near-north> <far-west/> <west/> <near-west/> <?a-pi pi-4?> <center center-attr-1="c1" center-attr-2="c2" center-attr-3="c3"> <!-- Comment-4 --> Level-4 <near-south-west/> <!--Comment-5--> Level-5 <?a-pi pi-5?> <near-south> <!--Comment-6--> Level-6 <?a-pi pi-6?> <south attr1="First" attr2="Last"> <far-south/> </south> </near-south> <near-south-east/> </center> <near-east/> <east/> <far-east/> </near-north> </north> <north-north-east1/> <north-north-east2/> </far-north> 1.1 xml-xalan/test/tests/conf/position/position101.xsl Index: position101.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- FileName: position101 --> <!-- Document: http://www.w3.org/TR/xpath --> <!-- DocVersion: 19991116 --> <!-- Section: 2.2 --> <!-- Creator: David Marston --> <!-- Purpose: Test count() starting on a comment and going upward. --> <xsl:output method="xml" indent="no" encoding="UTF-8"/> <xsl:template match="/"> <out> <xsl:for-each select="//center/comment()[1]"> <xsl:value-of select="count(ancestor-or-self::node())"/><xsl:text> nodes on this axis: </xsl:text> <xsl:apply-templates select="ancestor-or-self::node()" mode="census"/> </xsl:for-each> </out> </xsl:template> <xsl:template match="/" mode="census"> <xsl:text>Root Node </xsl:text> </xsl:template> <xsl:template match="*" mode="census"> <xsl:text>E: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="@*" mode="census"> <xsl:text>A: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="comment()" mode="census"> <xsl:text>C: </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="text()|processing-instruction()" mode="census"> <xsl:text>ERROR! </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> 1.1 xml-xalan/test/tests/conf/position/position98.xml Index: position98.xml =================================================================== <?xml version="1.0"?> <far-north> Level-1 <north-north-west1/> <north-north-west2/> <!-- Comment-2 --> Level-2 <?a-pi pi-2?> <north> <!-- Comment-3 --> Level-3 <?a-pi pi-3?> <near-north> <far-west/> <west/> <near-west/> <!-- Comment-4 --> Level-4 <?a-pi pi-4?> <center center-attr-1="c1" center-attr-2="c2" center-attr-3="c3"> <near-south-west/> <!--Comment-5--> Level-5 <?a-pi pi-5?> <near-south> <!--Comment-6--> Level-6 <?a-pi pi-6?> <south attr1="First" attr2="Last"> <far-south/> </south> </near-south> <near-south-east/> </center> <near-east/> <east/> <far-east/> </near-north> </north> <north-north-east1/> <north-north-east2/> </far-north> 1.1 xml-xalan/test/tests/conf/position/position98.xsl Index: position98.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- FileName: position98 --> <!-- Document: http://www.w3.org/TR/xpath --> <!-- DocVersion: 19991116 --> <!-- Section: 2.2 --> <!-- Creator: David Marston --> <!-- Purpose: Test count() starting on an attribute and going upward. --> <xsl:output method="xml" indent="no" encoding="UTF-8"/> <xsl:template match="/"> <out> <xsl:for-each select="//center/@center-attr-3"> <xsl:value-of select="count(ancestor-or-self::node())"/><xsl:text> nodes on this axis: </xsl:text> <xsl:apply-templates select="ancestor-or-self::node()" mode="census"/> </xsl:for-each> </out> </xsl:template> <xsl:template match="/" mode="census"> <xsl:text>Root Node </xsl:text> </xsl:template> <xsl:template match="*" mode="census"> <xsl:text>E: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="@*" mode="census"> <xsl:text>A: </xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="text()|comment()|processing-instruction()" mode="census"> <xsl:text>ERROR! </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> 1.1 xml-xalan/test/tests/conf/position/position99.xml Index: position99.xml =================================================================== <?xml version="1.0"?> <far-north> Level-1 <north-north-west1/> <north-north-west2/> <!-- Comment-2 --> Level-2 <?a-pi pi-2?> <north> <!-- Comment-3 --> Level-3 <?a-pi pi-3?> <near-north> <far-west/> <west/> <near-west/> <!-- Comment-4 --> Level-4 <?a-pi pi-4?> <center center-attr-1="c1" center-attr-2="c2" center-attr-3="c3"> <near-south-west/> <!--Comment-5--> Level-5 <?a-pi pi-5?> <near-south> <!--Comment-6--> Level-6 <?a-pi pi-6?> <south attr1="First" attr2="Last"> <far-south/> </south> </near-south> <near-south-east/> </center> <near-east/> <east/> <far-east/> </near-north> </north> <north-north-east1/> <north-north-east2/> </far-north> 1.1 xml-xalan/test/tests/conf/position/position100.xml Index: position100.xml =================================================================== <?xml version="1.0"?> <far-north> Level-1 <north-north-west1/> <north-north-west2/> <!-- Comment-2 --> Level-2 <?a-pi pi-2?> <north> <!-- Comment-3 --> Level-3 <?a-pi pi-3?> <near-north> <far-west/> <west/> <near-west/> <!-- Comment-4 --> Level-4 <?a-pi pi-4?> <center center-attr-1="c1" center-attr-2="c2" center-attr-3="c3"> Still Level-4 <near-south-west/> <!--Comment-5--> Level-5 <?a-pi pi-5?> <near-south> <!--Comment-6--> Level-6 <?a-pi pi-6?> <south attr1="First" attr2="Last"> <far-south/> </south> </near-south> <near-south-east/> </center> <near-east/> <east/> <far-east/> </near-north> </north> <north-north-east1/> <north-north-east2/> </far-north>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]