Одна из созданных мною таблиц стилей xslt имеет много применений, например:
<xsl:template match="ProductType">
<xsl:value-of select="../../Title"/>
</xsl:template>
, поэтому мой вопрос заключается в том, будет ли эффективнее создать новый набор узлов вручную, включающий только необходимые данные или, возможно, передаваемые сparams?
Что будет представлять собой лучшую практику для этого случая?
xml будет иметь форму, показанную ниже
<product>
<title>the title</title>
<tags>
<producttype>the product type</producttype>
<tags>
</product>
совпадение шаблона Actall выглядит следующим образом
<xsl:template match="ProductType" xml:space="default">
<xsl:param name="by" select="by"/>
<xsl:choose>
<xsl:when test="current()='Karaoke MP3+G'">
<div class="product-subhead">
<h3>Karaoke Song</h3>
<h3 class="middle">MP3+G</h3>
<h3>100% Legal Download</h3>
</div>
The track <xsl:value-of select="../../Title"/> is 100% legally covered by MCPS and PPL ensuring the artist <xsl:value-of select="../../Attribution"/> is paid royalties for every sale! Each karaoke track download from Mastermix Digital contains audio and graphics prompts. The song is provided in MP3+G format. Purchase is available through Paypal with all major credit cards.
</xsl:when>
<xsl:when test="current()='Track'">
<div class="product-subhead">
<h3>Original Version</h3>
<h3 class="middle">Available in 320kbps MP3 and WAV</h3>
<h3>100% Legal Download</h3>
</div>
The track <xsl:value-of select="../../Title"/> is 100% legally covered by MCPS and PPL ensuring the artist <xsl:value-of select="../../Attribution"/> is paid royalties for every sale! Each track download from Mastermix Digital is the original artist version and a guaranteed dancefloor filler! The audio is provided in high quality 320kbps mp3 format. Purchase is available through Paypal with all major credit cards.
</xsl:when>
<xsl:when test="current()='Extended Floorfillers'">
<div class="product-subhead">
<h3>Extended Version</h3>
<h3 class="middle">Available in 320kbps MP3 and WAV</h3>
<h3 class="phead3">100% Legal Download</h3>
</div>
Each extended floorfiller download from Mastermix Digital contains the original artist version mixed to be just that little bit longer! <xsl:value-of select="../../Title"/> is 100% legally covered by MCPS and PPL ensuring the artist <xsl:value-of select="../../Attribution"/> is paid royalties for every sale. The audio is provided in high quality 320kbps mp3 format. Purchase is available through Paypal with all major credit cards.
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
и копия xml, как показано ниже
<Tracks>
<Track AlbumArtURL="http://api.3.esh-partner.net/GetThumbnail.ashx?ID=07167B09-6365-4908-BFE6-811039D62D5E" IsBundle="true">
<ReportingCode>MG00089531</ReportingCode>
<Title Language="en-gb">Complete Number Ones Collection</Title>
<ExtendedTitle>Every UK No 1 in one download</ExtendedTitle>
<ExplicitContent>false</ExplicitContent>
<Attribution>Various Artists</Attribution>
<Duration Seconds="0">00:00:00</Duration>
<GRid>A1-0327D-MG00089531-J</GRid>
<CatalogNr>MFEG090</CatalogNr>
<OriginalReleaseFormat>CD</OriginalReleaseFormat>
<OriginalReleaseDate>2009-08-04</OriginalReleaseDate>
<ReleaseDate>2009-08-04</ReleaseDate>
<Description Language="en-gb">
<Long>One amazing collection! This download contains every single number 1 from the Official UK charts, since the charts began back in 1952 right up to the present day (not including the last 2 months)! That's more than 1,000 tracks, all in 320 KBPS (the highest quality, indistinguishable from quality you would get from a CD).
Save over £600 compared by buying every download individually!</Long>
</Description>
<Tags>
<ProductType>Track</ProductType>
</Tags>
<Attributes>
<Attribute Type="Text" Description="PriceCode">AA</Attribute>
<Attribute Type="LookupValue" Description="Category">MasterMix</Attribute>
</Attributes>
<Contributors />
<PriceBand>Mid/Front Premium</PriceBand>
<RecompilationRights>Yes</RecompilationRights>
</Track>
</Tracks>