2
做这个搜索,并没有找到答案的兄弟姐妹,所以这里去...XSLT:让孩子节点上下文节点
我有类似下面的一些XML:
<?xml version="1.0" encoding="utf-8"?>
<footnote ref="1">
<para>Here is some text about some guy who made
<emphasis role="italic">fascinating</emphasis> comment I want to quote
<blockquote> So I went to this place and met this guy....</blockquote>
It seemed more interesting at the time.
</para>
</footnote>
我想用XSLT将其更改为一个新的模式(使用新的命名空间前缀)
<?xml version="1.0" encoding="utf-8"?>
<nns:footnote ref="1">
<nns:fn-para>Here is some text about some guy who made
<nns:emph type="it">fascinating</nns:emph> comment I want to quote:
</nns:fn-para>
<nns:fn-blockquote>
<nns:bq-para>So I went to this place and met this guy....</nns:bq-para>
</nns:fn-blockquote>
<nns:fn-para> It seemed more interesting at the time.</nns:fn-para>
</nns:footnote>
我已经试过一些东西......采取对那脚注的后裔,并通过循环孩子们,但这是问题因为它不仅是para中的文本节点,还有emph标签,所以我仍然不知道如何将子节点放置在树上并放置在结果树中......这是否合理?
+1为一个很好的答案。 – 2011-03-01 04:13:01
+1好的分组风格。 – Flack 2011-03-01 05:13:47
非常感谢这个答案,这是工作得很好,虽然我很尴尬地说在这一刻,我没有100%直观的理解为什么它的作品...将阅读更多的关键和尝试用这种基本方法做一些不同的事情。再次感谢! – badperson 2011-03-01 16:43:30