Not
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Another way to separate the names by commas is to check a name to see if it is the first. In some circumstances this performs better than Example 1 of <xsl:if> , because the last() function requires that the entire set of names be found and counted, while this approach does not.
XML File (names.xml)
Use the names.xml listing in Example 1 of <xsl:if>, but edit the href attribute to point to ifcomma2.xsl.
XSLT File (ifcomma2.xsl)
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="namelist/name">
<xsl:if test="position()!=1">, </xsl:if>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Output
This is the formatted output:
Albert, Terrance, Will, Sylvia, Timothy, Gordon, James, Robert, Dan, Sasha
This is the processor output:
<?xml version="1.0" encoding="UTF-16"?>Albert, Terrance, Will, Sylvia, Timothy, Gordon, James, Robert, Dan, Sasha