- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有以下 XSLT:
<xsl:if test="$CurPos mod 2 =1">
<li style="width:604px;">
<div class="content-left" style="width:300px; height:290px;float:left;">
<xsl:if test="string-length($SafeImageUrl) != 0">
<div class="images-area-left">
<a href="{$SafeLinkUrl}" target="{$LinkTarget}">
<img class="image" src="{$SafeImageUrl}" alt="{@ImageUrlAltText}" />
</a>
<div class="Heading-desc">
<span class="NewsHeading"><h4><xsl:value-of select="@Title"/></h4></span>
<span class="Desc">
<xsl:value-of select="substring(@Comments,0,200)"/>
<xsl:if test="string-length(@Comments) > 200">…</xsl:if>
<a href="{$SafeLinkUrl}" class="ReadMore"> Read More</a>
</span>
</div>
</div>
</xsl:if>
</div>
<div class="content-right" style="float:right; width:300px; height:290px;">
<xsl:value-of select="following-sibling::*[1]/@PublishingRollupImage" disable-output-escaping="yes" />
<span class="NewsHeading"><h4><xsl:value-of select="following-sibling::*[1]/@Title"/></h4></span>
<span class="Desc" style="display:block; width:280px;"><xsl:value-of select="substring(following-sibling::*[1]/@Comments,0,200)"/>
<xsl:if test="string-length(following-sibling::*[1]/@Comments) > 200">…</xsl:if><a href="{$SafeLinkUrl}" class="ReadMore"> Read More</a>
</span>
</div>
</li>
</xsl:if>
有一个变量 $SafeLinkUrl 来自另一个模板,它获取当前行的页面 URL。由于我仍在当前节点上时正在获取后续兄弟节点,因此我无法获取后续兄弟节点的 URL。
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
============>指向这个模板
<xsl:template name="OuterTemplate.GetSafeLink">
<xsl:param name="UrlColumnName"/>
<xsl:if test="$UseCopyUtil = 'True'">
<xsl:value-of select="concat($RootSiteRef,'/_layouts/CopyUtil.aspx?Use=id&Action=dispform&ItemId=',@ID,'&ListId=',@ListId,'&WebId=',@WebId,'&SiteId=',$SiteId,'&Source=',$Source)"/>
</xsl:if>
<xsl:if test="$UseCopyUtil != 'True'">
<xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
<xsl:with-param name="UrlColumnName" select="$UrlColumnName"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
这调用了 ====>
<xsl:template name="OuterTemplate.GetSafeStaticUrl">
<xsl:param name="UrlColumnName"/>
<xsl:variable name="Url">
<xsl:call-template name="OuterTemplate.FormatColumnIntoUrl">
<xsl:with-param name="UrlColumnName" select="$UrlColumnName"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="cmswrt:EnsureIsAllowedProtocol($Url)"/>
</xsl:template>
它再次调用另一个模板,不断 =====>
<xsl:template name="OuterTemplate.FormatColumnIntoUrl">
<xsl:param name="UrlColumnName"/>
<xsl:variable name="Value" select="@*[name()=$UrlColumnName]"/>
<xsl:if test="contains($DataColumnTypes,concat(';',$UrlColumnName,',URL;'))">
<xsl:call-template name="OuterTemplate.FormatValueIntoUrl">
<xsl:with-param name="Value" select="$Value"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(contains($DataColumnTypes,concat(';',$UrlColumnName,',URL;')))">
<xsl:value-of select="$Value"/>
</xsl:if>
</xsl:template>
这是实际的 XML:https://gist.github.com/4380967
容器的 XSL:https://gist.github.com/4389989
单个行的 XSL:https://gist.github.com/4389997
我无法为 following-sibling::*[1] 使用 $SafeLinkUrl,因为它适用于当前元素而不是直接兄弟。我如何使该变量也适用于 sibling ??
最佳答案
使用:
<xsl:variable name="SafeLinkUrl">
<xsl:for-each select="following-sibling::*[1]">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
或者更好的是,向您的模板添加第二个参数:
<xsl:template name="OuterTemplate.GetSafeLink">
<xsl:param name="UrlColumnName"/>
<xsl:param name="pContext" select="."/>
<xsl:if test="$UseCopyUtil = 'True'">
<xsl:value-of select="concat($RootSiteRef,'/_layouts/CopyUtil.aspx?Use=id&Action=dispform&ItemId=', $pContext/@ID,'&ListId=',$pContext/@ListId,'&WebId=',$pContext/@WebId,'&SiteId=',$pContext/$SiteId,'&Source=',$Source)"/>
</xsl:if>
<xsl:if test="$UseCopyUtil != 'True'">
<xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
<xsl:with-param name="UrlColumnName" select="$UrlColumnName"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
对其他两个模板执行此操作。在调用两个内部模板中的任何一个时指定 $pContext
参数。
然后调用最外层的模板,将$pContext
参数指定为following-sibling::*[1]
。
关于html - 获取 sibling 之后的 xpath 以使用具有其值的模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14057476/
我一直在使用 angular-ui-router 并尝试从同一抽象的另一个 child 中转换到我的一个抽象状态的 child 。这张图更好地展示了这个想法: 所以“R”是模块,“蓝色 1”是我的抽象
很难解释我遇到的这个问题,因为有很多变数。 我的网站使用 javascipt 根据屏幕分辨率调整固定包装的大小,因此所有 div 都必须调整为 3 种不同的宽度,这就是使这个问题如此困难的原因.. H
我必须选择h1节点之间的所有内容。 Index some content some more content Index 2 some content other content Index 3 s
我目前正在使用已使用自定义 xml 转换器转换为 xml 的 VDA 消息类型。但是,源文档中的每个标题和行记录都处于同一级别,如下面的示例所示: 512
我需要查明 Table_3 是否包含属于某个父级的子级的所有 sibling 。例如,我询问 12 号 child (家长 1 = Charles)。 Table_2 告诉我他还有 2 个 sibli
所以我想选择一组元素中的最后一个兄弟元素,但是父容器中有多个元素。 Some text 所以在这种情况下,对于每一 block .select
我正在尝试为我的网站做一种 Accordion ,类似于 this website 上的那个。 , 但没有切换。 我正在使用的代码是 here . 我有基本的设置工作,但我似乎无法让 li 的高度正确
我很难尝试实现 XSL 转换。 我需要改变这个: 1 Homepage AB308E 5
我正在尝试创建一个爬虫来从供应商网站中提取一些属性数据,我可以根据我们的内部属性数据库对其进行审核,并且是 import.io 的新手。我看了一堆视频,虽然我的语法似乎是正确的,但我的手动 xpath
这是我的 xml 的摘录: content content 我定位在node[@id='1'] .我需要一个 Xpath 来匹配所有 元素直到下一个非空节点(这里是 node[@id='
我正在使用 Selenium-Python 来抓取此链接中的内容。 http://targetstudy.com/school/62292/universal-academy/ HTML代码是这样的,
这个问题在这里已经有了答案: Is there a CSS parent selector? (33 个答案) 关闭 4 年前。
代码笔:https://codepen.io/andrelange91/pen/VyjYBg 我做了以下声级示例,它应该在悬停时填充其他条。但目前是落后的...而且我一直没能找到一种方法(尽管我敢打赌
在下面的示例中,我试图获取所有 之前(包括当前的 ) class="current"具有番茄背景色。 所以在这个例子中:1、2、3、4 和 5 的背景颜色是番茄。 如果 我需要它来更新那class
在下面的例子中, h2 p p p h2 p p p h2 我只想在 h2.first 和 h2.second 之间选择 p。我试过 select si
对于下面的示例 HTML,返回具有 class='A' 和 class='B' 的“a”元素的 sibling 的 XPath 查询可以写为://a[@class='A']/following-sib
鉴于此 XML/HTML: Label1Value1 Label2Value2 Label3Value3aValue3b Label4Value4 我想找到所有 ,然后为每个找到
这是我在 StackExchange 的第一篇文章,如果我做错了什么,请多多包涵: 我有一个从产品数据库派生的 XML 文件,其中所有分组信息都丢失了,除了元素的顺序。所有产品都有一个首先出现的商品编
我希望以易于理解的方式描述我的问题。 我的 html 看起来像这样: AAAA BBBB 我想要 TextArea 的 Xpath(其中标签的值为 AAAA)用 Sel
我是一名优秀的程序员,十分优秀!