我想写xslt模板以匹配标记,后跟img标记。要匹配的模板<a>标记后跟<img>标记
样品有效来源:
1.<a title="google site" href="http://google.com"><img style="width: 141px; height: 167px;" alt="Image" title="Image" src="tcm:202-11587"/></a>
2.<a title="Internal link" href="tcm:202-9720"><img style="width: 141px; height: 167px;" alt="Image" title="Image" src="tcm:202-11587"/></a>
无效:
1.<a title="google site" href="http://google.com"></a>
<img style="width: 141px; height: 167px;" alt="Image" title="Image" src="tcm:202-11587"/>
2.<img style="width: 141px; height: 167px;" alt="Image" title="Image" src="tcm:202-11587"/>
<a title="google site" href="http://google.com"></a>
3.<a title="google site" href="http://google.com"><img style="width: 141px; height: 167px;" alt="Image" title="Image" src="tcm:202-11587"/></a>
<a title="Internal link" href="tcm:202-9720"><img style="width: 141px; height: 167px;" alt="Image" title="Image" src="tcm:202-11587"/></a>
4.<a><img/></a>
规则:
1.Only one Image should be allowed and it should be hyperlink.
2.There should be one <img> tag wrapped by one <a> tag.
3. Multiple images are not allowed.
4.Attributes for Image and a Tag.
5.No text is allowed for both the tags.
可以在任何帮助,如何编写模板来匹配这个条件。
要与该标签做什么? –
@ infantprogrammer'Aravind'。如果遇到这样的情况,我想检查一下情况。 – Patan