Help with output from XSLT!

binarysins

New member
Joined
Oct 1, 2005
Messages
2
Programming Experience
Beginner
I have a typed dataset that I have converted to XML with the schema, and I am trying to run a transform on it to convert portions to HTML. Basically, it's eventually going to be one row from the main table in the dataset and then any childrows from a couple of other tables. Right now I'm just playing around teaching myself the ropes. So far I think I've done the easy part - convert the dataset to HTML and load the XSLT (I even learned about memory streams in the process).

What is making me loopy is this:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:eek:utput method="html"/>
<xsl:template match="/*">
<head></head>
<body>Hi!</body>
</xsl:template>
</xsl:stylesheet>

This will return "Hi!" in the resulting HTML document. Change that to anything else, even elements I know should be there, and I get nothing.

The dataset is named VCSDS and I guess what I really need to know is what is the root? How do I format the template matches if there were, say, a tables in the dataset named "production", "movement" and "designs"? I'm having a hell of a time with this...if I change the template match to "VCSDS" I get nothing..."//designs" I get nothing. I know it's all context related, it's just I'm getting really frustrated...

Returns "Hi!" in the resulting HTML document. SO, what I really need answered is: if the dataset is named VCSDS and there are child elements named "designs" and "movement", what do I need to match to get those nodes back. Basically, what is the best way to structure this XSLT file?
 
You should provide a small sample of the xml file contents, so we can see the structure and names of the nodes.
Depending on structure and what to display, I would perhaps go for something like this:
VB.NET:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
 
<xsl:template match="/">
<head></head>
<body>
Here is an unordered list of somenode of items in production:
<br />
<xsl:apply-templates select="production" />
</body>
</xsl:template>
 
<xsl:template match="production">
<ul>
<xsl:for-each select="items">
<li><xsl:value-of select="somenode" /></li>
</xsl:for-each>
</ul>
</xsl:template>
 
</xsl:stylesheet>
 
JohnH said:
You should provide a small sample of the xml file contents, so we can see the structure and names of the nodes.
Depending on structure and what to display, I would perhaps go for something like this:

I've had quite a while to figure it out so it's working like a charm, but thanks!

Merry Christmas!
 
Back
Top