Extracting XML data to be used in XSLT HTML output

Ok:

I have done small level Xml stuff and am just now starting to understand
some of the plumbing involved. I've done a lot of .NET programming for SQL
Server, but little for Xml data stores.

I am currently just interested in using the .xsl file that I have being
applied to a source .xml file through ASP classic. Here's what I have:

XSL file
----------------------------------------------------------------------------
---
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" />

  <xsl:template match="/rss/channel">
    <xsl:for-each select="item">
      <div class="content" style="padding:5px;"><u><b><xsl:value-of
select="title" /></b></u></div>
      <div class="bodysm" style="padding:5px;"><xsl:value-of
select="pubDate" /></div><br />
      <div class="content" style="padding:5px;">
        <xsl:value-of select="description" />
      </div><br />
      <!-- ***** Line of Interest Below ***** -->
      <div class="content" style="border-bottom:1px solid
#ACACAC;padding:5px;"><b><a href=""><xsl:value-of select="link"
/></a></b></div><br />
    </xsl:for-each>
    <div class="content"
style="color:#ACACAC;padding:5px;text-align:right;">
      <i><xsl:value-of select="copyright" /></i><br />
      <!-- ***** Line of Interest Below ***** -->
      <a href="" style="color:#ACACAC;"><xsl:value-of select="link" /></a>
    </div>
  </xsl:template>

</xsl:stylesheet>

XML File
----------------------------------------------------------------------------
---
<?xml version="1.0" ?>
<rss version="2.0">
  <channel>
    <title>Test Feed</title>
    <link>http://www.grannet.net/rss/rss.xml</link>
    <description></description>
    <copyright>Copyright (c) 2004 Grant Harmeyer</copyright>
    <item>
      <title>First Entry in RSS</title>
      <link>http://www.hatfish.com/dvd.htm</link>
      <pubDate>Fri, 05 Dec 2003 16:26:36 CST</pubDate>
      <description>
        <![CDATA[

        ]]>
      </description>
    </item>
  </channel>
</rss>

The ASP code is written in JScript and works just fine, my question is this,
on the Xsl I have commented 2 "Lines of Interest". How do I take the data
that is stored in the <link /> child node of an <item /> and use it as the
target of the output HTML <a /> tag? I.E.: <a href="<link />"><link /></a>

I am sure this is 1 of 2 things. Extremely easy, or not possible given my
current route of implementation, and I guess it's the first of these 2.
Thanks in advance.


Grant Harmeyer


0
12/31/2003 8:21:43 PM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
798 Views

Similar Articles

[PageSpeed] 13

Grant,

I'll be thrilled when someone tells me how silly I am because there's a
better way, but I  brute force this by changing the output to text, then
escaping every blasted less than sign, then just shoving it in

&lt;a href="<xsl:value-of select="link"/>"/></a>

-- 
Kathleen Dollard
Microsoft MVP
Author "Code Generation in Microsoft .NET"


"Grant Harmeyer" <gn_harmeyer@hotmail.com> wrote in message
news:uv%23L2u9zDHA.2408@tk2msftngp13.phx.gbl...
> Ok:
>
> I have done small level Xml stuff and am just now starting to understand
> some of the plumbing involved. I've done a lot of .NET programming for SQL
> Server, but little for Xml data stores.
>
> I am currently just interested in using the .xsl file that I have being
> applied to a source .xml file through ASP classic. Here's what I have:
>
> XSL file
> --------------------------------------------------------------------------
--
> ---
> <?xml version="1.0" ?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" encoding="utf-8" />
>
>   <xsl:template match="/rss/channel">
>     <xsl:for-each select="item">
>       <div class="content" style="padding:5px;"><u><b><xsl:value-of
> select="title" /></b></u></div>
>       <div class="bodysm" style="padding:5px;"><xsl:value-of
> select="pubDate" /></div><br />
>       <div class="content" style="padding:5px;">
>         <xsl:value-of select="description" />
>       </div><br />
>       <!-- ***** Line of Interest Below ***** -->
>       <div class="content" style="border-bottom:1px solid
> #ACACAC;padding:5px;"><b><a href=""><xsl:value-of select="link"
> /></a></b></div><br />
>     </xsl:for-each>
>     <div class="content"
> style="color:#ACACAC;padding:5px;text-align:right;">
>       <i><xsl:value-of select="copyright" /></i><br />
>       <!-- ***** Line of Interest Below ***** -->
>       <a href="" style="color:#ACACAC;"><xsl:value-of select="link" /></a>
>     </div>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> XML File
> --------------------------------------------------------------------------
--
> ---
> <?xml version="1.0" ?>
> <rss version="2.0">
>   <channel>
>     <title>Test Feed</title>
>     <link>http://www.grannet.net/rss/rss.xml</link>
>     <description></description>
>     <copyright>Copyright (c) 2004 Grant Harmeyer</copyright>
>     <item>
>       <title>First Entry in RSS</title>
>       <link>http://www.hatfish.com/dvd.htm</link>
>       <pubDate>Fri, 05 Dec 2003 16:26:36 CST</pubDate>
>       <description>
>         <![CDATA[
>
>         ]]>
>       </description>
>     </item>
>   </channel>
> </rss>
>
> The ASP code is written in JScript and works just fine, my question is
this,
> on the Xsl I have commented 2 "Lines of Interest". How do I take the data
> that is stored in the <link /> child node of an <item /> and use it as the
> target of the output HTML <a /> tag? I.E.: <a href="<link />"><link /></a>
>
> I am sure this is 1 of 2 things. Extremely easy, or not possible given my
> current route of implementation, and I guess it's the first of these 2.
> Thanks in advance.
>
>
> Grant Harmeyer
>
>


0
1/1/2004 3:30:42 AM
Grant Harmeyer wrote:

>       <!-- ***** Line of Interest Below ***** -->
>       <div class="content" style="border-bottom:1px solid
> #ACACAC;padding:5px;"><b><a href=""><xsl:value-of select="link"
> /></a></b></div><br />

<div class="content" style="border-bottom:1px solid 
#ACACAC;padding:5px;"><b><a href="{link}"><xsl:value-of select="link"
 > /></a></b></div><br />

>       <!-- ***** Line of Interest Below ***** -->
>       <a href="" style="color:#ACACAC;"><xsl:value-of select="link" /></a>

<a href="{link}" style="color:#ACACAC;"><xsl:value-of select="link" /></a>

Learn about attribute-value templates in XSLT.

-- 
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog
0
Oleg
1/1/2004 11:52:53 AM
Oleg,

I love you!

I understand and use attribute-value templates. I did not realize they would
work in this context, and to be honest my head's still not totally around
why they do. I understand Key to be explaining them in a narrower context in
XSLT, Programmer's Reference. That will significnatly clean up some sample
templates (although the book's at the printers :( egg on face ):

-- 
Kathleen Dollard
Microsoft MVP
Author "Code Generation in Microsoft .NET"


"Oleg Tkachenko" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Ol%23jZ2F0DHA.2580@TK2MSFTNGP09.phx.gbl...
> Grant Harmeyer wrote:
>
> >       <!-- ***** Line of Interest Below ***** -->
> >       <div class="content" style="border-bottom:1px solid
> > #ACACAC;padding:5px;"><b><a href=""><xsl:value-of select="link"
> > /></a></b></div><br />
>
> <div class="content" style="border-bottom:1px solid
> #ACACAC;padding:5px;"><b><a href="{link}"><xsl:value-of select="link"
>  > /></a></b></div><br />
>
> >       <!-- ***** Line of Interest Below ***** -->
> >       <a href="" style="color:#ACACAC;"><xsl:value-of select="link"
/></a>
>
> <a href="{link}" style="color:#ACACAC;"><xsl:value-of select="link" /></a>
>
> Learn about attribute-value templates in XSLT.
>
> -- 
> Oleg Tkachenko
> XML Insider
> http://www.tkachenko.com/blog


0
1/1/2004 4:15:52 PM
Reply:

Similar Artilces:

How to get TASK_ID field for summary tasks without using Project.a
I know for tasks which are not summary tasks we can get TASK_ID field using statusing web service. But i could nto find any other options than Project web service to get TASK_ID field for summary tasks and the top level project task. Problem of using Project web service is that in my custom sharedpoint web part where we are using PSI web services we get all the data required using Resource and Statusing web service for the logged in resource. But Statusing web service retrieves TASK_ID only for actual tasks and not for summary tasks. Now just to get TASK_ID of summary tas...

Reformat data to vertical format
Here is what I am trying to do. http://www.totalcontrolproducts.com/totalcontrolproducts_OLD/download/images/Untitled-1.gif I have about a thousand records that I need in a vertical format with normal shared field name. Any suggestions -- Psydwaz ----------------------------------------------------------------------- Psydwaze's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2437 View this thread: http://www.excelforum.com/showthread.php?threadid=37965 see Creating a Spreadsheet from Database data (#dbdata) http://www.mvps.org/dmcritchie/excel/snakecol.htm...

Permissions is not allowing me to use my print preview.
Help! Don't understand My Permission in Excel. Even though I unrestrict, it still doesn't allow me to Preview my documents. How do I reset? Please Help, ...

2007
Project desktop expert, new to Project Server 2007 and working with a sandbox implementation currently. When I use the PWA Build Team...Replace to replace a generic resource on a project with an actual named resource after first publishing a plan, my updates don't appear to be reflected in Project Server. If I check out and open the Project Plan in MSP Pro, however, the updates were made, and then if I publish the schedule, the updates appear in server. I thought when you made resource updates using PWA that they should be reflected immediately (or as soon as the request...

Developing a robust database at one co. then using it at another c
Are there any legal implications of using the type of database listed above to perform similar functions for another company? The 2 company's are in 2 totally different industries and the new database will have to be modified to fit the requirements for the industry it is in. The database was developed at the old company. there is no such thing as a robust Jet database. Move to SQL Server if you want to build a solution that will work for the next decade. Jet is and always has been depecrated On Apr 7, 12:14=A0pm, BoaMan10 <BoaMa...@discussions.microsoft.com> w...

Line Graph with two different data points
Hello, I am trying to create a line chart with numbers from my product Vs a competitor. The problem i am having is how can i make a chart that will have four data points comparing to each other? For example Product A- 1.5 1.2 1.6 1.8 Product B- 2.0 1.1 1.2 1.3 Product A- 70% 20 % 30% 67% Product B- 65% 30% 65% 55% How do i get all of these numbers on one chart? Is a line chart correct. I want to see these numbers compared?? Thank you so much Hi, Since the number don't appear related to the percentages you might plot them on the same chart but two different axes. If they were relate...

Question on multiple NICs used by Exchange 2003
I have a requirement to bind four virtual SMTP servers to unique IP addresses. The server has four NICs and each IP address is uniquely bound to a virtual SMTP server. I used telnet to confirm that the appropriate virtual SMTP server responds to each assigned IP address. In case you are wondering why I did not use virtual IP addresses- Per Microsoft, the virtual IP address schema will not satisfy our requirement that the same IP address be used for sending (relaying) the e-mail that received it. Their recommendation was to have a NIC for each virtual SMTP server. The problem that I am ex...

How to search against XML files in the file system?
Putting the search textbox on the page is the easy part. What's preferred way to find terms in XML files located on the file system? Like finding stuff saved in XML files some of the blogs use these days to store their blog items? There can be lots and lots and lots of XML files on the file system to search. -- <%= Clinton Gallagher NET csgallagher AT metromilwaukee.com URL http://clintongallagher.metromilwaukee.com/ clintonG wrote: > Putting the search textbox on the page is the easy part. What's preferred > way to find terms in XML files located ...

Data changes when Analyzed with Excel
I have a query with 3 tables that represent master item list, count qty and as qty. When I look at the results in Query, all is well and accurate yet when I select Analyze with Excel, values change. For example, if a record shows zero qty in the as of field and zero quantity in the count field, I get a value in one or both of the fields that origianlly were zero. Other than linking the tables and grouping by master item list (to show all parts regardless of qty's), there are no formulas or expressions in this query. One of the tables is linked to a FoxPro table via ODBC driver. ...

How to use AjaxToolKit in asp.net for DHTML Editor
Dear Sir/Madam Please tell me how to use AjaxToolKit dll for DHTML purpose using C#. Thanks in Advance "Deep" <vinodkus@gmail.com> wrote in message news:7ac633e9-2cbd-4417-9b4e-363a9b5b3e74@d27g2000yqf.googlegroups.com... > Please tell me how to use AjaxToolKit dll for DHTML purpose using C#. http://tinyurl.com/ybfuqo8 ...

Appending XML to an existing XML file
Hey all, I've read a few articles about speed and XML processing - so I just want to make sure that I'm using the right strategy for what I want to achieve. I have an XML file that I'm appending to every time a user submits their information. Right now I'm using XMLDocument (Load and Save) in conjuncture with XmlElement objects. Is this the right approach or is there a faster approach? Thanks, Novice PS Here is a simplified version of what I'm doing: XmlDocument xdoc = new XmlDocument(); xdoc.Load("results.xml"); XmlNode node = xdoc.SelectSingleNode("...

Output to excel ==> replace worksheet
Usually out to excel will replace a workbook.Can we make it to replace worksheet only.Thank's "shiro" <shiro@myname?.com> wrote in message news:umONlZiRIHA.4584@TK2MSFTNGP03.phx.gbl... > Usually out to excel will replace a workbook.Can we make it > to replace worksheet only.Thank's How about, just replacing the contents of a cell, or cells? Dim appXL As Object Dim wkb As Object Dim wks As Object Set appXL = CreateObject("Excel.Application") Set wkb = appXL.Workbooks.Open("C:\MyFolder\MyWorkBook.xls") Set wks = wkb.Worksheets(1) wks.Cell...

Using the classes created with xsd.exe
I have created classes from several xsd files. These files create about 150 classes and spot checking them they do represent types in the xsd files. the question is how do I use these files. How do I load data into them and create xml from them. Is there some articles about this subject. Thank you, -- Jerry Hi Jerry, As for the classes you've generated, are they normal classes or dataset classes? As for the normal classes you generated through xsd.exe, you can use XML serialization to convert those class instances into XML content or deserialize the XML content back into objec...

Sorting Data Automatically
I am importing text into a new worksheet and would like to run a macro that can perform labour a labour intensive sort/deletion. Column A contains a mixture of text strings as follows: QR4567 QR4567/QT1223 QR4290 QR4290/QT1224 What I would like to do is determine how many QR's have associated QT's and how many QR's are remaining that dont have associated QT's. Any assistance would be greatly appreciated. Alan Bartley Sydney Australia Hi Alan not sure how the sorting comes into this - sounds more like needing a formula to count when a cell contains both QR & QT as op...

How should I debug or adobt better data processing for high speed
Hello! I have a program in MFC that collects data via USB, process it and display graphs. When data rate is relatively low(max. 1K bytes/Sec) the program works Ok but when data speed exceeds 10K bytes/Sec program goes crazy after a while and shows fictionally data . There is no problem for display section because it is buffered ( I have a buffered DC). The problem seems to be data processing. Because program is huge I can't post codes and I do not expect a solution but I try to explain general data processing scheme and I hope someone can advise me how to find weak points of progr...

Problems with DATE data type
Hi!!! I've got a little problem with the next macro in Excel. The problem is that I must look for some information in a data bas using as filter a specific day an hour in the year. I get the date and the hour using a form and then the macro calle "Busqueda" receives the value. I've programmed the macro using MSQuery just to see the necessary cod and the problem has appeared when I've tried to include the para called "Dia" in the SQL code. I've tried using " & Dia & " but it doesn't work and I don't know ho to include my param...

Reminders coming back after offline use
I have a user who uses Outlook on his laptop, but when he is out of the office he accesses mail through OWA. Every time he comes back in the office he says he gets inundated with old reminders popping up. And when you click on "Dismiss" you get an error that says, "conflicting edits have been made to the same item..." and there are duplicates of the event. I looked at this today and noticed that there is an event with the original date and the duplicate was showing a last-edited date of last Thursday. I asked if anything unusual happened last Thursday and he said he pro...

How to merge columns and rows into one cell besides using Merge and Center Icon?
I had posted this question before, but I couldn�t find this thread in any of the pages up till page 17. So I�m posting again. I want to merge all rows and columns starting from A1 to J2, with no lines in between into one cell. My text data value are in D1 and D2 respectively. Using Merge and Center Icon will only retain the upper-left most data, resulting the data in D2 to be deleted. So how to merge all rows and columns into one cell and yet prevent the data in D2 to be deleted? Any help will be greatly appreciated. ------------------------------------------------ ~~ Message posted from h...

XML: pros and cons ?
Hello everyone, I'd like to know which are the main pros and cons of using XML implementation in business organizations. >From a technical perspective, I find XML powerful, but looks like it is being pushed more from technical people than from businessmen... So, some questions: 1. Pros and cons 2. Main and most trustable effective uses of XML in real industrial companies and corporates ? 3. Any indications on costs and ROI, TCO ? Thank you so much in advance ! Andrea wrote: > Hello everyone, > I'd like to know which are the main pros and cons of using XML > impleme...

Virus Outbreak by using SMTP virtual server
Hi, The client was accidentally open approved-password.zip file then the nightmare began to spread out. It will use "system administrator" and "webmaster" as sender to inform the user that their password is grant or deny. Today, it tried to send out as NDR style. I assumed the virus on the workstation is using our smtp server. Will there a log that SMTP virtual server may generate so I can keep cross reference such as workstation or username so I can pinpoint? Any suggestion or recommendation will be appreciated. I am currently using Trend Micro Offican or Scan...

Using MFC dll from non-MFC application
I have been struggling several weeks with this problem. I need to call an MFC dll from a non-MFC application. The MFC dll was originally a working MFC program that I conveted to a dll. The dll works fine except that it crashes when I exit. Can anyone provide me with some snippets of working code showing how you did this? An example of the calling code, the CWinApp (or at least the InitInstance) and the hook function would be great. I have read several times that this should be easy to do, so I am probably just missing a simple line somewhere. The way I created my dll is to use to ...

xml schema and database strucure
hi, i am new to xml. i have been given some xml schemas, xsl files, sample xml file and sample html file. what i have to do is i) based on the sample html file, create a form which could take input. ii) store the input data in database iii) generate the xml file for that data ( based on sample XML file). Will anybody guide me which way to proceed. i mean what should i do? I have made a form to take input using asp.net. now i want to store that input data in SQL server tables but i don't know what tables would be there so that my final xml could match with the given sample xml. will anybo...

Deleting data from a table through a query
I have a database that is designed to update a list of credit union members from a master list so that vehicle insurance coverage can be tracked. I have been able to run an unmatched query to achieve a list of old members who have either paid off their vehicles or moved their loans to other locations. What I need to do now is delete these people from the main table. I have the cascade update and delete funtion in place to delete the vehicle information once the member is deleted, but I don't know how to take the information found in the unmatched query and delete those members fr...

Fill color in autoshape based on cell data
Dear Experts I have a range of cells with an autoshape in each cell. I would like to have the fill color of the autoshape change based on the results of an if statement in each cell. The if statment would return "G", "R", & "Y". The fill colors would be green, red, and yellow. I don't want conditional formatting for the cell fill color, only conditional formatting for the shape I was thinking a select case macro, but can't seem to get the code correct. However, I am a novice at macros Thanks for any assistance Jodi You could use the worksheet ...

Copy Data from Chart to Chart #2
I have to create separate charts for ten employees. I want to have all the data on one sheet tab. Create the chart on another tab for employee 1, format the chart the way I want and be able to add the data for employee 2, 3, 4, etc. to each tab, using the same format for chart 1 so they all match. So there should be one tab for raw data and 10 tabs for each employee. I’m using Excel 2000 Thank you Karen - Make a chart for the first employee, and make it look just the way you want it. Then right click on the sheet tab, select Move or Copy, and make a copy. Then make eight more copies....