I add 2 document types A and B under settings page,then I go to content page, I add one folder C under root, another folder D under folder C. Here is hierarchy in content tab page:
content my site name company news products C D about us ....
Folder C's document type is A, folder D's document type is B.
Now I want to read data from folder C and folder D in homepage.I don't know how to write xsl:for-each. please help, thanks a lot.
question about xsl:for-each
hi experts,
I add 2 document types A and B under settings page,then I go to content page, I add one folder C under root, another folder D under folder C. Here is hierarchy in content tab page:
content
my site name
company news
products
C
D
about us
....
Folder C's document type is A, folder D's document type is B.
Now I want to read data from folder C and folder D in homepage.I don't know how to write xsl:for-each. please help, thanks a lot.
Hi miken,
There's loads of ways you could do that, but here's a simple approach where you set a couple of variables to point to the documents you need to query:
<xsl:param name="currentPage" /> <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" /> <xsl:variable name="C" select="$siteRoot/C" /> <xsl:variable name="D" select="$C/D" /> <xsl:template match="/"> <h2>Here's a value from C:</h2> <p><xsl:value-of select="$C/@nodeName" /></p> <h2>Here's a value from D:</h2> <p><xsl:value-of select="$D/@createDate" /></p> </xsl:template>/Chriztian
thanks Chriztian.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.