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
645 Views

Similar Articles

[PageSpeed] 9

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:

extracting icons
Is there any way to extract an icon from an application? Take a look at the ExtractIcon[Ex]() API Cheers Check Abdoul --------------------- <davegreb@gpxinc.com> wrote in message news:c6c54da6-574c-4c8e-8ec9-3b77b99a5523@d70g2000hsb.googlegroups.com... > Is there any way to extract an icon from an application? ...

sort data
i am trying, unsuccessfullty, to sort some data (a small example is below) so I can graph it. I want to put it into a pivot table format but don't want calculations, just the actual data. any ideas??/ Location DATE Result WAT002WA ALBANY BOTTOM 19-Jul-05 0.83 WAT002WA ALBANY BOTTOM 23-Jun-05 0.8 WAT002WA ALBANY BOTTOM 28-May-05 1.16 WAT002WA ALBANY BOTTOM 02-May-05 0.93 WAT002WA ALBANY BOTTOM 06-Apr-05 0.66 WAT002WA ALBANY BOTTOM 11-Mar-05 0.59 WAT002WA ALBANY BOTTOM 13-Feb-05 0.54 WAT002WA ALBANY BOTTOM 18-Jan-05 0.62 WAT002WA ALBANY TOP 09-Mar-07 0.73 ...

Matching call data based on date, time and number called to give c
I have the following two tables on different sheets, both containing other information within them that is irrelevant in my question. SHEET 1 Date - Time - Number Called Duration Cost 01/02/10 09:05:21 01234123456 02:16 0.50 SHEET 2 Date - Time Number Called - Duration Extension 01/02/10 09:07:56 01234123456 02:15 1234 01/02/10 15:30:45 01234123456 01:59 1234 Sheet 2 HAS A LOT MORE RECORDS THAN SHEET 1 AND THERE ARE A NUMBER OF CALLS TO THE SAME NUM...

extracting totals from within a spreadsheet
I need to know how to take different information from within a spreadsheet --where two conditions/catogories must apply so that a third column where i have inputed hours, will total for those conditions only... can anyone help? Please spell out what you want we are not mind readers -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Jovetta" <Jovetta@discussions.microsoft.com> wrote in message news:91442C6D-03DF-4FC1-A069-AAB43FA57485@microsoft.com... >I need to know how to take different information from within a spreadsheet > --where two condi...

XslTransform
Hello, I'm receiving: 'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version' After I try and run my transformation. I spent a good few days coming up with the appropriate (I think) methods, and overrides for this task. I have verified that the source XML and XSL will transform by means of using the MSXML command line parsing tool (previous version of MSXML though). Here is my code: public XmlDocument xslTransformer(XPathNavigator xNav, XsltArgumentList xArgs) { //get xsl source XslTransform xslObj = new XslTransform(); //default permission set Evide...

XML question #2
Hi, I don't know much about XML but I thought it was a cross platform data file. I opened a CSV file in XL and saved it as XML. Not only did it save the file structure, plus the data, but also saved a lot of XL specific stuff. Now, I want to open the XML file with another programme (Filemaker) but I get an XML parsing error when it gets to the "ProtectScenarions" tag. Is there some way to save the file without all the XL-specific stuff ? Is there such a thing as "plain XML" ? Thanks Yrrreth. ...

finance.yahoo historical data
Hey, Is there someone who can help me get started with some code, ideas links (so vba code) how I can use a userform with a list from where I select a ticker symbol to extract historical data (where I can choose the range in time) into an excel-sheet (or databank access)? I searched the internet and only found one site (yahoo finance group) where there was a file, but the code is password protected ... . So I'm stuck for now, and have no idea how or where to start. thx in advance Dieter Furniere ...

when to use soap and when to use xml
Hi! I'm reading in a book and it says the following. "Use XML serialization when you need to exchange an object with an application that might not be based on the .NET Framework, and you do not need to serialize any private members." In the book it also says the following. "Use SoapFormatter when other application might read your seriazed data and when sending data across a network SoapFormatter also work reliably in situations where you could choose BinaryFormatter." So according to these two text sections I can use whichever of SoapFormatter and X...

Excel: extract and sum numerals from mixed text/numeral cell range
I have a large (30x20) grid of cells with data, and I want to extract and then sum up certain numerals from this entire range. The catch is that the data is mixed numerals and text, as you'll see below. Here's an abbreviated 3x3 example, with a value in each of the nine cells: V7.1 T H P1 A T B V3 P4.5 If I just wanted to sum up the instances of "T" appearing, I could use COUNTIF() for the entire range to come up with answer ("T" appears 2 times). Easy enough. But, what I'm trying to accomplish is to sum up the numerals associated w...

How do I create project schedule using excel
I need to create a project schedule using excel. Please help. Hi lack of details :-) Maybe give some more information what you're trying to do? -- Regards Frank Kabel Frankfurt, Germany raeisza wrote: > I need to create a project schedule using excel. Please help. ...

Extract emails from cells with text
I have a row in column A which includes an email address in the text that I'd like to extract to column B. Is there a formula I can use to accomplish extracting the email address only to column B? Here's an example of different cells in column A: Please email example@law.ufl.edu to contact us...... OR Schedule an appointment for assistance, or email example@uga.edu with your questions... Thank you Try this... All on one line: =TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND (" ",A1&" ",FIND("@",A1))-1)," ", REPT(" ",...

Data............Group
if I group columns and hide the columns with the + is it possible to give the diferent groups names where they are listed at the top left 1, 2, 3. Not quite sure what you want, but maybe.... View|Custom Views would allow you to hide/show the groups the way you want. Esrei wrote: > > if I group columns and hide the columns with the + is it > possible to give the diferent groups names where they are > listed at the top left 1, 2, 3. -- Dave Peterson ...

Appending data in cells that utilize a Dropdown list.
Hello all, I would like to append entries in cells that utilize a dropdown list. Currently, when I select (in this case names) from my dropdown list I cannot append them if I want to add more than one to a cell. If I select another name from the dropdown, it erases the first entry. Is there some way to append entries within cells that use this form of validation so that I can enter more than one in a cell from the dd list? -- Thanks, Geek using Office XP Professional Hi Geek Debra Dalgleish has an example workbook showing how to do this http://www.contextures.com/excelfiles.html...

How to create DB schema from XML schema
Hello All, We have XSD file with XML schema and want to generate database or SQL from it. Visual studio reads XSD file and shows everything graphically fine. Is there anyway, we could actually transfer the graphical information to database? Best regards, Neo ...

data migration of cdf tables to crm
hi, i am trying to implement crm for an organisation. the cdf tables for both accounts and contacts are ready and data is present int he info tables.but the next step of migration is not happening. executing the migration.exe tool shows process completed in the log but verifying the migration_info table shows "not processed" against the corresponding rows.it is not showing any errors but still not migrating. please help. i can use all the help i could get. thank you. "Yamini.P.S" <Yamini.P.S@discussions.microsoft.com> wrote in message news:94FD56E3-3B28-43D...

sending data to com port
Hello, I am using VC++ 6.0 (of Visual studio 6.0) How can I send data to com port via VC++ code ? Need sample code, please. Thanks :) See this article on codeproject..it covers up most of the stuff... http://www.codeproject.com/system/serial_com.asp - Parhar "Eitan" <no_spam_please@nospam.com> wrote in message news:uVpJFP87DHA.1804@TK2MSFTNGP12.phx.gbl... > Hello, > I am using VC++ 6.0 (of Visual studio 6.0) > How can I send data to com port via VC++ code ? > Need sample code, please. > > Thanks :) > > See the "CSerial" class from Tom...

queries which pull data in multiple "rows" in one table and compar
I have a project to complete where the end user wants me to write several queries which pull data in multiple "rows" in one table and compare them to data in another using access. He also needs a report written based on the findings of which data meets certain criteria within those queries. I think the report part will be pretty easy, but can someone give me some suggestions on what would be the best way to create the queries in access? Thanks Da Chosen One On Sun, 10 Jan 2010 19:22:01 -0800, Da Chosen One <Da Chosen One@discussions.microsoft.com> wrote: You...

Please Help! Messed up Hard Drive from using Partition Magic
I wanted to use Partition Magic to partition my hard drive, so I used the boot CD. When I loaded it up, it said that there were 2 errors in my hard drive and it could fix them, so I pressed fix. Unfortunately, I was running Vista and I only know now that they're incompatible. However, now my hard drive is completely screwed! If I plug my hard drive into my computer, my computer refuses to do anything after POST, it doesn't boot a CD or run anything from the hard drive. I unplugged my hard drive and it's booting CDs now, even though my CD was the primary boot device anyway...

I thought it used to have formulas... now it doesn't!
A long time ago I remember having a "slightly" modified Publisher Invoice Template that automatically calculated taxes and totals. Then one day a few years ago... the automated totals disappeared Now, I am using Publisher XP, and short of embedding an Excel object (which creates too many formatting and line-item matching issues to be useful), I can't figure out a way to get the automated totals and such Any ideas? This is a multi-part message in MIME format. ------=_NextPart_000_0031_01C4008D.AC8F55C0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Enco...

XML with two tables
HI The XML below has two tables.They are Category and Products. I need to get the Products when i select a Category for eg:- when i mention "CAR" the i need to get "maruthi","santro" and "ford". The relation between the two tables is "Category_Product". I'm getting all the products. Can any one Help me. <?xml version="1.0" encoding="utf-8" ?> <Catalog xmlns="http://tempuri.org/Products.xsd"> <Category> <Name>Car </Name> <Product> <title>Maruthi</title&...

Compile data from several workbooks
I have multiple workbooks for different projects. they are all in separate sub folders. Within each wookbook is a worksheet I call Bug. The Bug sheet pulls the data from that workbook which I need in a separate master workbook. I want to pull the data from every Bug worksheet into my master workbook without having to open each file to force it to update. I can do it cell by cell using a direct link but that is a lot of work. I have compiled a list of each workbook including the path. I can use that path and get the data using =INDIRECT(ADDRESS(2,3,,,F3) where F3 is the path. ...

data points #3
I have a scatter chart with the following info : sales price, square footage, and subdivision. With the x and y axis being sales price and square footage. There are some entries where i will have several sales in one subdivision and i would like all those points to show up in the same color. How do i get several points to show up in the same color instead of excel assigning each entry a new label? Include all the related points in the same data series, rather than as a different data series for each point. -- David Biddulph "affordablegreen" <affordablegreen@discussion...

Fill text boxes with data from another text box
I have a form that has two sections. Section 1 has orginator name, address, city state, zip. Section two has owner name, address, city, state, and zip. If orginator and owner are the same, I want to just hit a button or check mark to copy data from section one to section two. Can this be done, and how would you do it. Thanks for your help- Porkchop. Porkchop, To copy data from one control (and, hence, field, if the form control source is set to the name of a field in the form's underlying record source), put the following in the AfterUpdate event procedure of the checkbox: If ...

when i change data in a sum forumla, the sum doesn't change?
i am doing a simple sum formula, using it several times in the worksheet, and it used to work fine, however, suddenly now the formulas are only working after the initial calculation, if i go back and change data later on, the formula doesn't reflect any changes and special pasting of the formula only reproduces the value of the original calculation! I want the Sum function to work as it should. Reflect changes as they are made and be able to paste a function to another group of cells! Under Tools->Options->Calculation make sure Automatic is checked "richard_kta"...

select with linq distinct Tagnames from xml-source
hello, I have the following xml source <root> <rec> <id/> <name/> <price/> </rec> <rec> <id/> <name/> </rec> </root> I want to get a string List which holds all names of all children of the <rec> nodes. But only once. so the desired resultlist should contain the elements "id","name","price" I fail to achieve this with a Linq "select". Can anybody give me a clue. thanks Mark Markus Ohlenroth wrote: > <root> > <rec> > <id/> > <name/> > &...