English 中文(简体)
我想从我的XML档案中提取数据,并将其用作链接。
原标题:I want to pull data from my XML file and use it as link

这是我的xml板

<ErrorLog_list>
<error><download_list>/home/fes/logs/ErrorLog-20111109.gz</download_list></error>
<error><download_list>/home/fes/logs/ErrorLog-20111110.gz</download_list></error>
<error><download_list>/home/fes/logs/ErrorLog-20111114.gz</download_list></error>
</ErrorLog_list>

我想做的是建立与<代码>error/download_list的链接。

因此,我使用了这一标签。

<a href="{ErrorLog_list/error/download_list}"><xsl:value-of select="Title"/></a><br/>

但是,它没有工作......

我认识到,这个问题可能是因为它被称作<代码>xmlns属性不被解释为属性价值模板。

我的问题是,我如何能够改变我的名字空间,使用上述方法? 希望得到任何帮助。

Please ignore my negligence. Thanks

最佳回答

We should have the whole XML document to make a complete answer but here is what I can say.

由于你写了<代码><xsl: Value-of selected=“Title”/>,但我们可以看看任何<代码>Title/code>要素,我猜测,我们采用一种模版规则,对包含Title的内容加以匹配,并包含Error Carlo_list/code>。

因此,当你使用属性价值模板<代码>{ 页: 1 我猜测,所交还的 no点将协调一致,以显示价值,从而将使用首批 no的价值,而不是其他价值。

页: 1 或制定与<代码>匹配的模板规则 Error Carlo_list/error/download_list/code. 如果你想避免使用属性模板价值,也可在模板管理机构内使用<代码>xsl:attribute

<xsl:template match="download_list">
    <a>
        <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
        <xsl:value-of select="../../../Title"/>
    </a>
</xsl:template>
问题回答

暂无回答




相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签