T
Tony
Hello!
I know that this isn't the right forum but I hope someone know this anyway.
I have one xml file and one xslt file shown below.
I want to transform this xml file into html by using this xslt document but
I can't find out why the html is not being created.
Here is the documentation I have found
How to: Execute an XSLT Transformation from the XML Editor
Visual Studio 2010 Other Versions Visual Studio 2008
Visual Studio 2005
0 out of 1 rated this helpful Rate this topic
The XML Editor allows you to associate an XSLT style sheet with an XML
document, perform the transformation, and view the output. The resulting
output from the XSLT transformation is displayed in a new document window.
The Output property specifies the filename for the output. If the Output
property is blank, a filename is generated in your temporary directory. The
file extension is based on the xslutput element in your style sheet and
can be .xml, .txt or .htm.
If the Output property specifies a filename with an .htm or .html extension,
the XSLT output is previewed using Microsoft Internet Explorer. All other
file extensions are opened using the default editor chosen by Microsoft
Visual Studio. For example, if the file extension is .xml, Visual Studio
uses the XML Editor.
To execute an XSLT transformation from an XML document
Open an XML document in the XML Editor.
Associate an XSLT style sheet with the XML document.
Add an xml-stylesheet processing instruction to the XML document. For
example, add the following line <?xml-stylesheet type='text/xsl'
href='filename.xsl'?> to the document prolog.
-or-
Add the XSLT style sheet using the Properties window. In the document
Properties Window, click the Browse button for the Stylesheet field, select
the XSLT style sheet, and click Open.
Click the Show XSL Output button on the XML Editor toolbar.
There is no Show XSL Output in the XML tool button.
I use VS 2010 professional.
Can somebody explain what I'm missing here ?
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="book.xsl"?>
<books>
<book>
<chapter number="1">This is the first chapter</chapter>
<chapter number="2">This is the second chapter</chapter>
<chapter number="3">This is the third chapter</chapter>
<chapter number="4">This is the fourth chapter</chapter>
<chapter number="5">This is the fifth chapter</chapter>
</book>
</books>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>This shows the context position and context size</title>
</head>
<body>
<h3>Context position and context size demo.</h3>
<xsl:apply-templates select="/Book/Chapter" />
</body>
</html>
</xsl:template>
<xsl:template match="Chapter">
<xsl:if test="position()=2">
<p>When the context node is the second <b>Chapter</b> element node
then </p>
<p>the context position is <xsl:value-of select="position()" /></p>
<p>and the context size is <xsl:value-of select="last()" /></p>
<p>The text the <b>Chapter</b> element node contain is <xsl:value-of
select="." /></p>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
I know that this isn't the right forum but I hope someone know this anyway.
I have one xml file and one xslt file shown below.
I want to transform this xml file into html by using this xslt document but
I can't find out why the html is not being created.
Here is the documentation I have found
How to: Execute an XSLT Transformation from the XML Editor
Visual Studio 2010 Other Versions Visual Studio 2008
Visual Studio 2005
0 out of 1 rated this helpful Rate this topic
The XML Editor allows you to associate an XSLT style sheet with an XML
document, perform the transformation, and view the output. The resulting
output from the XSLT transformation is displayed in a new document window.
The Output property specifies the filename for the output. If the Output
property is blank, a filename is generated in your temporary directory. The
file extension is based on the xslutput element in your style sheet and
can be .xml, .txt or .htm.
If the Output property specifies a filename with an .htm or .html extension,
the XSLT output is previewed using Microsoft Internet Explorer. All other
file extensions are opened using the default editor chosen by Microsoft
Visual Studio. For example, if the file extension is .xml, Visual Studio
uses the XML Editor.
To execute an XSLT transformation from an XML document
Open an XML document in the XML Editor.
Associate an XSLT style sheet with the XML document.
Add an xml-stylesheet processing instruction to the XML document. For
example, add the following line <?xml-stylesheet type='text/xsl'
href='filename.xsl'?> to the document prolog.
-or-
Add the XSLT style sheet using the Properties window. In the document
Properties Window, click the Browse button for the Stylesheet field, select
the XSLT style sheet, and click Open.
Click the Show XSL Output button on the XML Editor toolbar.
There is no Show XSL Output in the XML tool button.
I use VS 2010 professional.
Can somebody explain what I'm missing here ?
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="book.xsl"?>
<books>
<book>
<chapter number="1">This is the first chapter</chapter>
<chapter number="2">This is the second chapter</chapter>
<chapter number="3">This is the third chapter</chapter>
<chapter number="4">This is the fourth chapter</chapter>
<chapter number="5">This is the fifth chapter</chapter>
</book>
</books>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>This shows the context position and context size</title>
</head>
<body>
<h3>Context position and context size demo.</h3>
<xsl:apply-templates select="/Book/Chapter" />
</body>
</html>
</xsl:template>
<xsl:template match="Chapter">
<xsl:if test="position()=2">
<p>When the context node is the second <b>Chapter</b> element node
then </p>
<p>the context position is <xsl:value-of select="position()" /></p>
<p>and the context size is <xsl:value-of select="last()" /></p>
<p>The text the <b>Chapter</b> element node contain is <xsl:value-of
select="." /></p>
</xsl:if>
</xsl:template>
</xsl:stylesheet>