Groups | Blog | Home
all groups > dotnet xml > january 2006 >

dotnet xml : A question on joining more than one xml document to xsl file??


Aaron
1/21/2006 11:34:19 AM
How do it bind the articlelink nodes in the layout.xsl??

I have several xml pages(art1.xml, art2.xml, so on) that I know how link
them up via articles.xml,
<?xml version="1.0" encoding="utf-8"?>
<articles>
<articlelink href="art1.xml"/>
<articlelink href="art2.xml"/>
......
</articles>

But the layout.xsl page is this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="Article">
<table align="center" width="95%" bordercolor="000000"
bordercolordark="000000" bordercolorlight="000000">
<tr>
<td>
<font size="5">
<b>
<xsl:value-of select="Title"/>
</b>
</font>
</td>
<td>
<xsl:value=of select="Author"/>
</td>
</tr>
<tr>
<td colspan=2>
<xsl:value-of select="substring(Body,1,350)" disable-output-escaping="yes"
/>
</td>
</tr>
<tr>
<td align="left">
<b><xsl:value-of select="Date"/></b>
</td>
<td>
<a href="http://{name}">
<xsl:value-of select="thelink" />
</a>
<br/>
<hr size=2>
</td>
</tr>
</table>
<hr size=2 color=blue />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

TIA

Aaron
1/21/2006 6:05:47 PM
Dimitre,

So what part of XSLT, for-each--apply-templates--variable?

TIA


[quoted text, click to view]

Aaron
1/21/2006 8:01:19 PM
I have tried document-for every type tag from XSLT and nothing. I know that
it can be done--thanks for you help Dimitre.



[quoted text, click to view]

Dimitre Novatchev
1/22/2006 7:59:13 AM
Read about the document() function in XSLT, then use it.

Cheers,
Dimitre Novatchev


[quoted text, click to view]

Dimitre Novatchev
1/22/2006 1:29:02 PM
http://www.w3.org/TR/xslt#document


[quoted text, click to view]

AnthonyWJones
1/22/2006 1:58:02 PM
Aaron,

If you could post an example of what is inside art(n).xml files it would
helpful.

In particular do each file contain exactly one article node (as the root
node) or can they hold multiple articles.

I'll assume one article and that the root node is the Article node.

Your for-each in the XSL should look like this:-

<xsl:for-each select="document(//articlelink/@href)/article">


But as I said an example of the art xml would allow for a more accurate
answer.

Anthony.

[quoted text, click to view]
Aaron
1/22/2006 3:43:17 PM
Anthony,

Thanks for the help--I solved the problem.

Aaron


[quoted text, click to view]

Dimitre Novatchev
1/22/2006 4:36:58 PM
For more information and examples, see the relevant section of the XSL FAQ:

http://www.dpawson.co.uk/xsl/sect2/N2602.html


Cheers,
Dimitre Novatchev


[quoted text, click to view]

AddThis Social Bookmark Button