У меня есть проблема с синтаксисом Xslt, моя таблица стилей:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<root>
<xsl:for-each select="for $x in(collection('file:///Users/admin/Documents/xmlSoapUi/?select=*.xml;recurse=yes'))return saxon:discard-document($x)//testsuite">
<ident>
<xsl:value-of select="base-uri()"/>
<xsl:if test="matches(base-uri(),'Catalog')">
<xsl:call-template name="summaryCatalog"/>
</xsl:if>
<xsl:if test="matches(base-uri(),'Status')">
<xsl:call-template name="summaryStatus"/>
</xsl:if>
<xsl:if test="matches(base-uri(),'Alarm')">
<xsl:call-template name="summaryAlarm"/>
</xsl:if>
</ident>
</xsl:for-each>
</root>
</xsl:template>
<xsl:template name="summaryCatalog">
<xsl:variable name="avgAddFile" select="avg(testcase[@name='addFile']/@time)"/>
<xsl:variable name="avgGetFile" select="avg(testcase[@name='getFile']/@time)"/>
<xsl:variable name="avgRemoveFile" select="avg(testcase[@name='removeFile']/@time)"/>
<xsl:variable name="avgAddGroup" select="avg(testcase[@name='addGroup']/@time)"/>
<xsl:variable name="avgGetGroup" select="avg(testcase[@name='getGroup']/@time)"/>
<xsl:variable name="avgRemoveGroup" select="avg(testcase[@name='removeGroup']/@time)"/>
<xsl:variable name="avgAddMedia" select="avg(testcase[@name='addMedia']/@time)"/>
<xsl:variable name="avgGetMedia" select="avg(testcase[@name='getMedia']/@time)"/>
<xsl:variable name="avgRemoveMedia" select="avg(testcase[@name='removeMedia']/@time)"/>
<xsl:variable name="avgAddMediaComponent" select="avg(testcase[@name='addMediaComponent']/@time)"/>
<xsl:variable name="avgGetMediaComponent" select="avg(testcase[@name='getMediaComponent']/@time)"/>
<xsl:variable name="avgRemoveMediaComponent" select="avg(testcase[@name='removeMediaComponent']/@time)"/>
<xsl:variable name="avgAddOpus" select="avg(testcase[@name='addOpus']/@time)"/>
<xsl:variable name="avgGetOpus" select="avg(testcase[@name='getOpus']/@time)"/>
<xsl:variable name="avgRemoveOpus" select="avg(testcase[@name='removeOpus']/@time)"/>
<xsl:variable name="avgAddTrack" select="avg(testcase[@name='addTrack']/@time)"/>
<xsl:variable name="avgGetTrack" select="avg(testcase[@name='getTrack']/@time)"/>
<xsl:variable name="avgRemoveTrack" select="avg(testcase[@name='removeTrack']/@time)"/>
<testChargeCatalog>
<avgAddFile><xsl:value-of select="format-number($avgAddFile,'0.00000')"/></avgAddFile>
<avgGetFile><xsl:value-of select="format-number($avgGetFile,'0.00000')"/></avgGetFile>
<avgRemoveFile><xsl:value-of select="format-number($avgRemoveFile,'0.00000')"/> </avgRemoveFile>
<avgAddGroup><xsl:value-of select="format-number($avgAddGroup,'0.00000')"/></avgAddGroup>
<avgGetGroup><xsl:value-of select="format-number($avgAddGroup,'0.00000')"/></avgGetGroup>
<avgRemoveGroup><xsl:value-of select="format-number($avgAddGroup,'0.00000')"/></avgRemoveGroup>
<avgAddMedia><xsl:value-of select="format-number($avgAddMedia,'0.00000')"/></avgAddMedia>
<avgGetMedia><xsl:value-of select="format-number($avgAddMedia,'0.00000')"/></avgGetMedia>
<avgRemoveMedia><xsl:value-of select="format-number($avgAddMedia,'0.00000')"/></avgRemoveMedia>
<avgAddMediaComponent><xsl:value-of select="format-number($avgAddMediaComponent,'0.00000')"/></avgAddMediaComponent>
<avgGetMediaComponent><xsl:value-of select="format-number($avgGetMediaComponent,'0.00000')"/></avgGetMediaComponent>
<avgRemoveMediaComponent><xsl:value-of select="format-number($avgRemoveMediaComponent,'0.00000')"/></avgRemoveMediaComponent>
<avgAddOpus><xsl:value-of select="format-number($avgAddOpus,'0.00000')"/></avgAddOpus>
<avgGetOpus><xsl:value-of select="format-number($avgGetOpus,'0.00000')"/></avgGetOpus>
<avgRemoveOpus><xsl:value-of select="format-number($avgRemoveOpus,'0.00000')"/></avgRemoveOpus>
<avgAddTrack><xsl:value-of select="format-number($avgAddTrack,'0.00000')"/></avgAddTrack>
<avgGetTrack><xsl:value-of select="format-number($avgGetTrack,'0.00000')"/></avgGetTrack>
<avgRemoveTrack><xsl:value-of select="format-number($avgRemoveTrack,'0.00000')"/></avgRemoveTrack>
</testChargeCatalog>
</xsl:template>
<xsl:template name="summaryStatus">
<xsl:variable name="avgAddStatus" select="avg(testcase[@name='addStatus']/@time)"/>
<xsl:variable name="avgGetStatus" select="avg(testcase[@name='getStatus']/@time)"/>
<testChargeStatus>
<avgAddStatus><xsl:value-of select="format-number($avgAddStatus,'0.00000')"/></avgAddStatus>
<avgGetStatus><xsl:value-of select="format-number($avgGetStatus,'0.00000')"/></avgGetStatus>
</testChargeStatus>
</xsl:template>
<xsl:template name="summaryAlarm">
<xsl:variable name="avgAddAlarm" select="avg(testcase[@name='addAlarm']/@time)"/>
<xsl:variable name="avgGetAlarm" select="avg(testcase[@name='getAlarm']/@time)"/>
<testChargeAlarm>
<avgAddAlarm><xsl:value-of select="format-number($avgAddAlarm,'0.00000')"/></avgAddAlarm>
<avgGetAlarm><xsl:value-of select="format-number($avgGetAlarm,'0.00000')"/></avgGetAlarm>
</testChargeAlarm>
</xsl:template>
я хочу создать шаблон с <xsl:for-each select="AllVariables">
, а затем применить некоторые преобразования кзначение переменных.
Я не знаю, возможно ли это, потому что я не видел ни одного примера в сети.
Спасибо за помощь