[oXygen-user] XSL transformation

Aga Shirazi
Tue Nov 11 09:32:41 CST 2003


Guys,

Sorry about not being clear, earlier. Here is a sample of my XML file.

<book>
	<author></author>
		<co_author></co_author>
		<co_author></co_author>
		<co_author></co_author>
</book>

<book>
	<author></author>
		<co_author></co_author>
</book>

<book>
	<author></author>
		<co_author></co_author>
</book>

.....
(n number of books)


I tried using <xsl:for-each select="author/co_author"/> along with 
<xsl:value-of select="//co_author"/> but it ittirates through the whole 
sheet and repeats just the first co-outhor.

I hope you guys have understood what im say.

Thanks
Aga Shirazi




*****************************************************************

you wrote

Dear Aga,

There are a lot of possible answers and one cannot know what fits best your 
needs unless you provide more details. Please consider posting a cut down 
sample that shows your problem.

Sure you do not need to rename the author tags as author1, author2, etc. 
you can access each of them separately. For instance if you use an XPath 
expression like //author you can access all the author elements in your 
input document. If you want to iterate through them you can use
Code:

<xsl:for-each select="//author">...</xsl:for-each>


You can have a template that matches author an if you issue apply-templates 
that will act on author elements that template will be activated.
If you want to access the first three author elements then //author[1], 
//author[2] and //author[3] will select them respectivelly.

Best Regards,
George


More information about the oXygen-user mailing list