Why doesn't it output anything?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi everyone——
Im using xslt and xml to output from an xml to an html into a file in a Windows Console App——
【xml】
<pre style="background:rgb(158,207,207); color:black; font-family:NSimSun <span style="color:blue <?<span style="color:#a31515 xml<span style="color:blue <span style="color:red version<span style="color:blue ="<span style="color:blue 1.0"<span style="color:blue ?>
<span style="color:blue <<span style="color:#a31515 catalog<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk101"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Gambardella, Matthew<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >XML Developers Guide<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Computer<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >44.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-10-01<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
An in-depth look at creating applications
with XML.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk102"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Ralls, Kim<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Midnight Rain<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Fantasy<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >5.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-12-16<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk103"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Corets, Eva<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Maeve Ascendant<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Fantasy<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >5.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-11-17<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk104"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Corets, Eva<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Oberons Legacy<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Fantasy<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >5.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2001-03-10<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
In post-apocalypse England, the mysterious
agent known only as Oberon helps to create a new life
for the inhabitants of London. Sequel to Maeve
Ascendant.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk105"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Corets, Eva<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >The Sundered Grail<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Fantasy<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >5.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2001-09-10<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberons Legacy.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk106"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Randall, Cynthia<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Lover Birds<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Romance<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >4.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-09-02<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
When Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk107"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Thurman, Paula<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Splish Splash<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Romance<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >4.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-11-02<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
A deep sea diver finds true love twenty
thousand leagues beneath the sea.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk108"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Knorr, Stefan<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Creepy Crawlies<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Horror<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >4.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-12-06<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
An anthology of horror stories about roaches,
centipedes, scorpions and other insects.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk109"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Kress, Peter<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Paradox Lost<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Science Fiction<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >6.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-11-02<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems
of being quantum.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk110"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >OBrien, Tim<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Microsoft .NET: The Programming Bible<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Computer<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >36.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-12-09<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
Microsofts .NET initiative is explored in
detail in this deep programmers reference.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk111"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >OBrien, Tim<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >MSXML3: A Comprehensive Guide<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Computer<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >36.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2000-12-01<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
The Microsoft MSXML3 parser is covered in
detail, with attention to XML DOM interfaces, XSLT processing,
SAX and more.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue <span style="color:red id<span style="color:blue ="<span style="color:blue bk112"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 author<span style="color:blue >Galos, Mike<span style="color:blue </<span style="color:#a31515 author<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Visual Studio 7: A Comprehensive Guide<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 genre<span style="color:blue >Computer<span style="color:blue </<span style="color:#a31515 genre<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 price<span style="color:blue >49.95<span style="color:blue </<span style="color:#a31515 price<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 publish_date<span style="color:blue >2001-04-16<span style="color:blue </<span style="color:#a31515 publish_date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >
Microsoft Visual Studio 7 is explored in depth,
looking at how Visual Basic, Visual C++, C#, and ASP+ are
integrated into a comprehensive development
environment.
<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 catalog<span style="color:blue >[/code]
【xslt】
<pre style="background:rgb(158,207,207); color:black; font-family:NSimSun <span style="color:blue <?<span style="color:#a31515 xml<span style="color:blue <span style="color:red version<span style="color:blue ="<span style="color:blue 1.0"<span style="color:blue <span style="color:red encoding<span style="color:blue ="<span style="color:blue utf-8"<span style="color:blue ?>
<span style="color:blue <<span style="color:#2b91af xsl:stylesheet<span style="color:blue <span style="color:red version<span style="color:blue ="<span style="color:blue 1.0"<span style="color:blue <span style="color:red xmlns:xsl<span style="color:blue ="<span style="color:blue http://www.w3.org/1999/XSL/Transform"
<span style="color:blue <span style="color:red xmlns:msxsl<span style="color:blue ="<span style="color:blue urn:schemas-microsoft-com:xslt"<span style="color:blue <span style="color:red exclude-result-prefixes<span style="color:blue ="<span style="color:blue msxsl"
<span style="color:blue >
<span style="color:blue <<span style="color:#2b91af xsl:variable<span style="color:blue <span style="color:red name<span style="color:blue ="<span style="color:blue idvalue"<span style="color:blue />
<span style="color:blue <<span style="color:#2b91af xsl:template<span style="color:blue <span style="color:red match<span style="color:blue ="<span style="color:blue /"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 table<span style="color:blue <span style="color:red style<span style="color:blue ="<span style="color:blue background:grey"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 tr<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 th<span style="color:blue >
catalogId
<span style="color:blue </<span style="color:#a31515 th<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 th<span style="color:blue >
categoryName
<span style="color:blue </<span style="color:#a31515 th<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 tr<span style="color:blue >
<span style="color:blue <<span style="color:#2b91af xsl:for-each<span style="color:blue <span style="color:red select<span style="color:blue ="<span style="color:blue catalog/book[@id=$idvalue]"<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 tr<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 td<span style="color:blue >
<span style="color:blue <<span style="color:#2b91af xsl:value-of<span style="color:blue <span style="color:red select<span style="color:blue ="<span style="color:blue @id"<span style="color:blue />
<span style="color:blue </<span style="color:#a31515 td<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 td<span style="color:blue >
<span style="color:blue <<span style="color:#2b91af xsl:value-of<span style="color:blue <span style="color:red select<span style="color:blue ="<span style="color:blue title"<span style="color:blue />
<span style="color:blue </<span style="color:#a31515 td<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 tr<span style="color:blue >
<span style="color:blue </<span style="color:#2b91af xsl:for-each<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 table<span style="color:blue >
<span style="color:blue </<span style="color:#2b91af xsl:template<span style="color:blue >
<span style="color:blue </<span style="color:#2b91af xsl:stylesheet<span style="color:blue >
[/code]
【cs】

<pre style="background:rgb(158,207,207); color:black; font-family:NSimSun <span style="color:#2b91af XPathDocument doc = <span style="color:blue new<span style="color:#2b91af XPathDocument(Request.MapPath(<span style="color:#a31515 "Sample.xml"));
<span style="color:#2b91af XslTransform xlst = <span style="color:blue new<span style="color:#2b91af XslTransform();
xlst.Load(Request.MapPath(<span style="color:#a31515 "SampleTransfer.xslt"));
<span style="color:#2b91af XsltArgumentList arguments = <span style="color:blue new<span style="color:#2b91af XsltArgumentList();
arguments.AddParam(<span style="color:#a31515 "idvalue", <span style="color:#a31515 "", <span style="color:#a31515 "bk101");
[/code]
<pre style="background:rgb(158,207,207); color:black; font-family:NSimSun <span style="color:#2b91af XmlTextWriter writer = <span style="color:blue new <span style="color:#2b91af XmlTextWriter(…………);
xlst.Transform(doc, arguments, writer);
writer.Flush();
writer.Close();[/code]
But it output nothings?why?is "idvalue" assignment wrong?!<br/>

View the full article
 
Back
Top