我似乎有点卡住了。我正在尝试生成新的ID,但它不计算我想要它的方式。 我有以下xml文件:
<componentcontent>
<explanation>
<include filename="ha-c41-ep1.xml"/>
<exercises>
<include filename="ha-c41-ot1.xml"/>
<include filename="ha-c41-ot2.xml"/>
</exercises>
</explanation>
<explanation>
<include filename="ha-c41-u1.xml"/>
<exercises>
<include filename="ha-c41-u11.xml"/>
<include filename="ha-c41-ex-4.xml"/>
</exercises>
</explanation>
</componentcontent>
我希望解释文件(不是练习)具有以下ID:filename =“1-u1”,filename =“1-u2”等。
目前我使用以下xslt:
<xsl:template match="componentcontent/explanation/include">
<xsl:copy>
<xsl:attribute name="local:_file" select="local:new-paragraph-filename(., 'u' )"/>
<xsl:apply-templates select="node() | @*" />
<xsl:number count="explanation/include" level="any"/>
</xsl:copy>
</xsl:template>
<xsl:template match="c:file[exercise[@type eq 'explanation']]">
<xsl:variable name="include" as="element(include)?" select="key('includes', @name)"/>
<xsl:if test="not($include)">
<xsl:message terminate="yes">Geen include-element gevonden voor file met naam <xsl:value-of select="@name"/>.</xsl:message>
</xsl:if>
<xsl:copy>
<xsl:attribute name="name" select="local:new-paragraph-filename(key('includes', @name), 'u' )"/>
<xsl:apply-templates select="node() | @* except @name"/>
</xsl:copy>
</xsl:template>
这给了我以下输出:
<componentcontent>
<explanation>
<include filename="1-u1.xml">1</include>
<exercises>
<include filename="ha-c41-ot1.xml"/>
<include filename="ha-c41-ot2.xml"/>
</exercises>
</explanation>
<explanation>
<include filename="1-u1.xml">2</include>
<exercises>
<include filename="ha-c41-u11.xml"/>
<include filename="ha-c41-ex-4.xml"/>
</exercises>
</explanation>
</componentcontent
我的问题是,有人能指出我正确的方向,因为计数不是我想要的方式吗?
亲切的问候
答案 0 :(得分:0)
怎么样:
@Override
public void setImage(final String url, final ImageView view,
WXImageQuality quality, final WXImageStrategy strategy) {
LogUtil.v("准备加载图片URL---" + url);
Picasso.with(WXEnvironment.getApplication())
.load(url)
.into(view);
}