标签-多图片字段切割(刈)+图片编号

2019-07-27  本文已影响0人  吴加明
效果图

标签内容config

<?xml version="1.0" encoding="utf-8"?>
<root>
  <LabelType>MM标签</LabelType>
  <LabelIntro>
  </LabelIntro>
  <OutType>sin</OutType>
  <LabelDataType>static</LabelDataType>
  <EnabelAjax>False</EnabelAjax>
  <attributes>
    <name>pics</name>
    <datatype>supersql</datatype>
    <default>
    </default>
    <intro>图片字段</intro>
  </attributes>
  <IsXsltSql>false</IsXsltSql>
  <IsXsltCountSql>false</IsXsltCountSql>
  <LabelSqlString>SELECT PhotoUrl,PhotoIntro FROM PE_U_Photo WHERE ID=@itemid</LabelSqlString>
  <LabelTemplate><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pe="labelproc" exclude-result-prefixes="pe">
<xsl:param name="pics" />
<xsl:output method="html" />
<xsl:template match="/">
    <xsl:call-template name="strSplit">
        <xsl:with-param name="strUrl" select="$pics"/>
    <xsl:with-param name="NumBer" select="1"/>
    </xsl:call-template>
</xsl:template>
<xsl:template name="strSplit">
    <xsl:param name="strUrl"/>
  <xsl:param name="NumBer"/>
        <xsl:choose>
            <xsl:when test="contains($strUrl,'$$$')">
            <xsl:if test="substring-before($strUrl,'$$$')!=''">
<li>
<h2>
<xsl:choose>
<xsl:when test="substring-before(substring-before($strUrl,'$$$'),'|')!=''">
<xsl:value-of select="substring-before(substring-before($strUrl,'$$$'),'|')"/>
</xsl:when>
<xsl:otherwise>
产品图片<xsl:value-of select="$NumBer"/>
</xsl:otherwise>
</xsl:choose>
</h2>
<div class="big_pic">
<a>
<xsl:attribute name="href">
<xsl:value-of select="pe:ConvertAbsolutePath(substring-after(substring-before($strUrl,'$$$'),'|'))"/>
</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="pe:ConvertAbsolutePath(pe:GetAnySizePic(substring-after(substring-before($strUrl,'$$$'),'|'),600,400))"/>
</xsl:attribute>
</xsl:element>
</a>
</div>
</li>
                </xsl:if>
            
                <xsl:call-template name="strSplit">
                  <xsl:with-param name="strUrl" select="substring-after($strUrl,'$$$')"/>
            <xsl:with-param name="NumBer" select="$NumBer + 1"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
<li>
<h2>
<xsl:choose>
                <xsl:when test="substring-before($strUrl,'|')!=''">
<xsl:value-of select="substring-before($strUrl,'|')"/>
                </xsl:when>
                <xsl:otherwise>
          产品图片<xsl:value-of select="$NumBer"/>
                </xsl:otherwise>
                </xsl:choose>
</h2>       
<div class="big_pic">
<a>
<xsl:attribute name="href">
<xsl:value-of select="pe:ConvertAbsolutePath(substring-after($strUrl,'|'))"/>
</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="pe:ConvertAbsolutePath(pe:GetAnySizePic(substring-after($strUrl,'|'),600,400))"/>
</xsl:attribute>
</xsl:element>
</a>
</div>

</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:transform>]]></LabelTemplate>
  <Version officialVersion="" modifiedVersions="3017" compatibleVersion="" />
</root>
上一篇下一篇

猜你喜欢

热点阅读