简体   繁体   English

通过属性errot为xml标签创建xslt

[英]xslt creation for xml tag throughing attribute errot

I am trying to create an xslt for my xml tags which consists of links, images and text. 我正在尝试为我的XML标签创建一个xslt,它由链接,图像和文本组成。 I tried but I could not create it. 我尝试过,但是无法创建它。 Can you guys tell me what I am doing wrong? 你们能告诉我我做错了吗?

Here is my xml and xslt in a fiddle: http://jsfiddle.net/N8MnE/2/ . 这是我的xml和xslt: http//jsfiddle.net/N8MnE/2/

When I run it in this tool I am getting the following error: 此工具中运行它时,出现以下错误:

XSLT Error: The markup in the document preceding the root element must be well-formed. XSLT错误:根元素前面的文档中的标记必须格式正确。

Here is my code: 这是我的代码:

<xsl:attribute name="src">
<xsl:value-of select="ImageBlock / Image " /></xsl:attribute>

Your XSLT is not well-formed XML. 您的XSLT格式不正确。 You XSLT contains spaces between < and next character, ie: 您的XSLT包含<和下一个字符之间的空格,即:

< xsl

As the message tells you, you still have a well-formedness error. 消息告诉您,您仍然有格式错误。 The next one is 下一个是

<xsl:value-of select="//Datum[@Name="ATTservicesTab"]//TabHeading"/>

Notice that you're nesting double quotes inside of double quotes. 注意,您将双引号嵌套在双引号内。 You can rewrite this as: 您可以将其重写为:

<xsl:value-of select="//Datum[@Name='ATTservicesTab']//TabHeading"/>

in the four places where it occurs. 在它发生的四个地方。 Then your stylesheet will parse. 然后,您的样式表将进行解析。

I strongly recommend getting a good tool for working with XML, such as nxml-mode for emacs. 我强烈建议获得一个使用XML的好工具,例如emacs的nxml-mode You could find an error like this in about 0.2s. 您可能会在约0.2秒内发现这样的错误。

you have 你有

///Datum

that occurred twice, change that to 发生两次,将其更改为

//Datum

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM