1

Topic: XSLT a cycle

Good evening.
Is xml (approximately):

<root>
<root1>
</root1>
...
<subroot1> text </subroot1>
...
<subroot1> text2 </subroot1>
...
<root2>
<subroot2>
{info}
</subroot2>
<subroot2>
{info2}
</subroot2>
</root2>
...
</root>

If words. There is data about (person) in subroot2, and in the given example, at us 2 persons with the different information
And as is . to these people, well let will be, a place residing (city) but as in section root1 there is besides it still other information.
Is xslt, I will try to show too on fingers:
We begin a cycle:
<xsl:for-each select = "/root/root2">
<xsl:value-of select = "/subroot">//it is received for example a surname of the person
<xsl:value-of select = "./root1/subroot1">//the QUESTION: how to receive 2 value, instead of two times the first?
</xsl:for-each>
. at me the nonsense turns out: a surname deduces different, and subroot1 - one and too value

2

Re: XSLT a cycle

</root1> it is closed after <subroot1>...

3

Re: XSLT a cycle

<xsl:variable name = "pos" select = "position ()"/>
<xsl:value-of select = "./root1/subroot1 [$pos]">

4

Re: XSLT a cycle

wrote:

<xsl:value-of select = "/subroot">//it is received for example a surname of the person

And what, it works? The request beginning with a slash, goes to a root, and a root it root, instead of subroot.