我为标签写了一个xslt 但是对于第一个标签,我无法将href链接放在我的标签内..
你能告诉我在xslt中我做错了什么以及如何把它... 提供我的代码
标签部分
<a>
<xsl:attribute name="href">
<xsl:value-of select="LinkURL"/>
</xsl:attribute>
<xsl:for-each select="ImageBlock">
<div class="tab-att-info__picture">
<img>
<xsl:attribute name="src">
<xsl:value-of select="Image"/>
</xsl:attribute>
</img>
</div>
<xsl:value-of select="Alt"/>
</xsl:for-each>
</a>
xml输入
<TabContent>
<Heading/>
<ImageBlock>
<Image>/resources/images/shop-landing/bundles.jpg</Image>
<Alt>Bundles</Alt>
</ImageBlock>
<LinkBlock>
<LinkText>Bundles</LinkText>
**<LinkURL>http://www.news.com</LinkURL>**
<LinkTarget>same</LinkTarget>
<LinkAltTitle>Bundles</LinkAltTitle>
</LinkBlock>
</TabContent>
在
下面提供我的html输出<div class="tabs__pane tabs__pane--active shop__att__inner-content" id="services-tab-1">
<div class="tab-att-info__item">**<a href="">**<div class="tab-att-info__picture"><img src="/resources/images/shop-landing/bundles.jpg"/></div>Bundles</a>
</div>
<div class="tab-att-info__item">**<a href="">**<div class="tab-att-info__picture"><img src="/resources/images/shop-landing/wireless.jpg"/></div>Wireless</a>
</div>
<div class="tab-att-info__item">**<a href="">**<div class="tab-att-info__picture"><img src="/resources/images/shop-landing/business_services.jpg"/></div>Business Services</a>
</div>
<div class="tab-att-info__item">**<a href="">**<div class="tab-att-info__picture"><img src="/resources/images/shop-landing/phone.jpg"/></div>BusinessPhone</a>
</div>
<div class="tab-att-info__item">**<a href="">**<div class="tab-att-info__picture"><img src="/resources/images/shop-landing/internet.jpg"/></div>Internet</a>
</div>
<div class="tab-att-info__item"><a href=""><div class="tab-att-info__picture"><img src="/resources/images/shop-landing/business_tv.jpg"/></div>Business TV</a>
</div>
</div>
答案 0 :(得分:0)
您需要更改
<xsl:value-of select="LinkURL"/>
到
<xsl:value-of select="LinkBlock/LinkURL"/>