使用XSLT在模式中显示更多信息

时间:2018-04-20 21:13:39

标签: xml xslt

我在使用XML和XSLT时遇到了困难。我希望在页面上的某个图块中有一些信息,然后您可以单击更多信息按钮,弹出一个模式,其中包含有关此人的额外信息。但是,目前所有模态都显示有关列表中第一个人的信息,并且不确定如何对此进行排序。

1 个答案:

答案 0 :(得分:1)

It's probably because you have multiple modals, one for each person, with the same id; "myModal".

What you could try doing is changing the id of the modal to this....

<div class="modal fade" id="myModal{position()}" role="dialog">

And the button to this...

<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal{position()}">More Info</button>

The curly braces here are Attribute Value Templates, which means the result of the expression will be evaluated and placed in the attributes. In other words, your modals will have the ids; "myModal1", "myModal2" etc, and so be unique.