Hi,
I have an XML document below document called pressinfo.xml:
<?xml version='1.0'?>
<press_info>
<press>
<pressDate>Tue 10 Sep, 2002</pressDate>
<pressDetail>This Is A Test Xyz</pressDetail>
<presslink>/press/Newpress
.asp?itemc
ode=478</p
resslink>
</press>
<press>
<pressDate>Tue 10 Sep, 2002</pressDate>
<pressDetail>New Press Release Testing</pressDetail>
<presslink>/press/Newpress
.asp?itemc
ode=477</p
resslink>
</press>
<press>
<pressDate>Mon 22 Sep, 2002</pressDate>
<pressDetail>Xml Final Testing Page </pressDetail>
<presslink>/press/Newpress
.asp?itemc
ode=472</p
resslink>
</press>
<press>
<pressDate>Mon 22 Sep, 2002</pressDate>
<pressDetail>This Is A Test 22 July</pressDetail>
<presslink>/press/Newpress
.asp?itemc
ode=471</p
resslink>
</press>
<press>
<pressDate>Wed 17 Sep, 2002</pressDate>
<pressDetail>Xml Final </pressDetail>
<presslink>/press/Newpress
.asp?itemc
ode=464</p
resslink>
</press>
</press_info>
I have an XSL document below document called press_default.xsl:
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" version="1.0">
<!--TEMPLATE RULE FOR ROOT ELEMENT-->
<xsl:template match="/">
<html>
<body>
<br/><br/>
<xsl:call-template name="check"/>
</body>
</html>
</xsl:template>
<xsl:template name="check">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="#cccccc"><font face="verdana" size="2">
<td bgcolor="#cccccc"><b>Headl
ine</b></t
d>
<td bgcolor="#cccccc"><b>Date<
/b></td>
</font>
</tr>
<xsl:for-each select="//press">
<tr>
<td width="60%">
<font face="verdana" size="2">
<xsl:value-of select="pressDetail" />
</font>
</td>
<td width="40%" valign="top">
<font face="verdana" size="2">
<xsl:value-of select="pressDate" />
</font>
</td>
</tr>
</xsl:for-each>
<tr>
<td colspan="2"><br/></td>
</tr>
</table>
<table width="100%">
<tr>
<td colspan="2"><a href="/press"><font face="verdana" size="2">more press releases >></font></a></td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
And the document below transform the XML using XSL document is called pressxml2.asp:
<% 'Load into a DOM document
'Dim DomDocLoc
DomDocLoc=Server.MapPath("
/includes/
XMLFiles/p
ressinfo.x
ml")
'Dim DomDoc
Set DomDoc = Server.CreateObject("MSXML
2.FreeThre
adedDOMDoc
ument.4.0"
)
DomDoc.Async=False
DomDoc.Load DomDocLoc
'Load the style sheet into a DOM document
'Dim StyleDoc
Set StyleDoc = Server.CreateObject("MSXML
2.FreeThre
adedDOMDoc
ument.4.0"
)
StyleDocLoc=Server.MapPath
("/include
s/XMLStyle
sheet/pres
s_default.
xsl")
StyleDoc.Load StyleDocLoc
'Transform and return to the browser for confirmation
strOutput = DomDoc.TransformNode(Style
Doc)
response.write strOutput
'Destroy the object variables
set styledoc=nothing
set domdoc = nothing
%>
my problem is that I want the link the pressdetails to a specific page, ie each pressDetails has a different page displaying the different press releases.
I tried putting the link into an XML tag called presslink. Is it possible to call this using the <a href=<xsl:value-of select="pressDetail" />>
.something to that effect I tried it using that but it gives me errors.
Any answers will be greatly appreciated.
Start Free Trial