我嘗試做一個奇怪的轉換。使用XSLT重複元素x的次數
XML看起來是這樣的:
<?xml version="1.0" standalone="yes"?>
<Parent>
<RecordCount>4</RecordCount>
<Record name="1">
<Child1>Value 1</Child1>
<Child2>Value 2</Child2>
</Record>
</Parent>
而這正是它需要看起來像:
<?xml version="1.0" standalone="yes"?>
<Parent>
<RecordCount>4</RecordCount>
<Record name="1">
<Child1>Value 1</Child1>
<Child2>Value 2</Child2>
</Record>
<Record name="2">
<Child1>Value 1</Child1>
<Child2>Value 2</Child2>
</Record>
<Record name="3">
<Child1>Value 1</Child1>
<Child2>Value 2</Child2>
</Record>
<Record name="4">
<Child1>Value 1</Child1>
<Child2>Value 2</Child2>
</Record>
</Parent>
是這樣甚至可以用XSLT還是應該我寧願只是處理這個代碼?
看到這裏如何迭代從1到N:http://stackoverflow.com/questions/8701011/for-loop-in-xslt-page/8703214#8703214 – LarsH