XML primjer i njegov XSLT i pozivanje u ASP  u


<?hml version="1.0" encoding="utf-8" ?>

<vijesti>

<vijest id="1">

<naslov>Dobijena koncesija</naslov>

<tekst>Nakon dugo vremena dobijena..</tekst>

<datum>23.12.2004</datum>

<prikaz value="true"/>

</vijest>

<vijest id="2">

<naslov>Smanjen broj radnika</naslov>

<tekst>U tvornici toj i toj..</tekst>

<datum>25.12.2004</datum>

<prikaz value="true"/>

</vijest>

</vijesti>

<?hml version="1.0" ?>

<linkovi>

<link id="home" url="#index.asp">Home</link>

<link id="about" url="#about.asp">About</link>

<link id="programiranje" url="#programiranje.asp">Programiranje</link>

<link id="download" url="#download.asp">Download</link>

</linkovi>

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/linkovi">

<xsl:text>| </xsl:text>

<xsl:for-each select="link">

<a>

<xsl:attribute name="href">

<xsl:value-of select="@url"/>

</xsl:attribute>

<xsl:value-of select="."/>

</a>

<xsl:text> | </xsl:text>

</xsl:for-each>

</xsl:template>

</xsl:stylescheet>

<%

set linkovi = Server.CreateObject("MSXML2.DomDocument.4.0")

Linkovi.async=False

Linkovi.load Server.MapPath("linkovi.xml")

set LinkoviTrans = Server.CreateObject("MSXML2.DomDocument.4.0")

Linkovitrans.async = False

LinkoviTrans.load Server.MapPath("linkovi.xslt")

Response.write Linkovi.TransformNode(LinkoviTrans)

%>

<%

set Link = Linkovi.selectSingleNode("/linkovi/link[@id='home']")

if not (Link Is Nothing) then

urlHome= Link.getattribute("url")

Else

urlHome= ""

end if

%>

Na vrh stranice..