[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Transforming an XML document linked to a XML schem

Subject: RE: Transforming an XML document linked to a XML schema
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 30 Jan 2002 09:04:34 -0000
namespace pfx xsl
It may be failing because it can't find the schema (You've written its URL
rather oddly with a newline in the middle).

It may also be failing because the schema defines a default value for a
namespace declaration attribute, which causes all the namespaces in your
source document to change. In my view this should be a criminal offence, but
it's a surprisingly common practice.

Actually, I wouldn't expect this stylesheet to work even in the absence of
the schema, because the source document declares a default namespace, and
the stylesheet refers to the elements without any namespace prefix. If
<bpxml> is in a non-null namespace, then the stylesheet must refer to it as
pfx:bpxml where the namespace prefix pfx is assigned to the appropriate
namespace URI.

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Purnima
> Fernando
> Sent: 29 January 2002 23:38
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Transforming an XML document linked to a XML schema
>
>
> I am using Excelon Stylus Studio.
>
> I have also tries Xalan for the transformation.
>
> My Style sheet is as follows:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> 	<!-- Define the output type -->
> 	<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
> 	<!-- Ignore text nodes -->
> 	<xsl:template match="text()|@*"/>
> 	<!-- Matches the root tag -->
> 	<xsl:template match="/">
> 		<xsl:apply-templates/>
> 	</xsl:template>
>
> 	<xsl:template match="/bpxml/developer">
> 		<html>
> 			<body>
> 				<head>
> 					<meta
> http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1"/>
> 					<title>Development
> Specifications - BuildPro Objects</title>
> 				</head>
>
> 				<h1>BuildPro Version 8
> Developer (xdev)</h1>
> 				<p>Copyright (c) 1999-2002
> TODAY Systems, Inc.<br/>
> 				   Company Confidential Document</p>
> 				<h3>BuildPro Objects</h3>
> 				<hr/>
> 				<table border="1" width="100%">
> 					<tr>
> 						<td align="center">
> 							<b>Object</b>
> 						</td>
> 						<td>&nbsp;
> 						</td>
> 					</tr>
> 					<xsl:apply-templates/>
> 				</table>
> 			</body>
> 		</html>
> 	</xsl:template>
>
> 	<xsl:template match="Component">
> 		<tr>
> 			<td>
> 				<b>
> 					<xsl:value-of select="@Name"/>
> 				</b>
> 			</td>
> 			<td>
> 				<table width="100%" border="1">
> 					<tr>
> 						<td
> align="center" width="11%">
> 							<b>Property</b>
> 						</td>
> 						<td
> align="center" width="53%">
>
> <b>Description</b>
> 						</td>
> 						<td
> align="center" width="5%">
> 							<b>Required</b>
> 						</td>
> 						<td
> align="center" width="5%">
> 							<b>Type</b>
> 						</td>
> 						<td
> align="center" width="6%">
> 							<b>Default</b>
> 						</td>
> 						<td
> align="center" width="12%">
> 							<b>Options</b>
> 						</td>
> 						<td
> align="center" width="8%">
> 							<b>Limits</b>
> 						</td>
> 					</tr>
> 					<xsl:apply-templates/>
> 				</table>
> 			</td>
> 		</tr>
> 	</xsl:template>
>
> 	<xsl:template match="Property">
> 		<tr>
> 			<td>
> 				<xsl:value-of select="@Name"/>
> 			</td>
> 			<td>
> 				<xsl:choose>
> 					<xsl:when
> test="boolean(string(Description))">
> 						<xsl:value-of
> select="Description"/>
> 					</xsl:when>
> 					<xsl:otherwise>&nbsp;
> 					</xsl:otherwise>
> 				</xsl:choose>
> 			</td>
> 			<td>
> 				<xsl:choose>
> 					<xsl:when
> test="boolean(string(@Required))">
> 						<xsl:value-of
> select="@Required"/>
> 					</xsl:when>
> 					<xsl:otherwise>&nbsp;
> 					</xsl:otherwise>
> 				</xsl:choose>
> 			</td>
> 			<td>
> 				<xsl:choose>
> 					<xsl:when
> test="boolean(string(Type))">
> 						<xsl:value-of
> select="Type"/>
> 					</xsl:when>
> 					<xsl:otherwise>&nbsp;
> 					</xsl:otherwise>
> 				</xsl:choose>
> 			</td>
> 			<td>
> 				<xsl:choose>
> 					<xsl:when
> test="boolean(string(Default))">
> 						<xsl:value-of
> select="Default"/>
> 					</xsl:when>
> 					<xsl:otherwise>&nbsp;
> 					</xsl:otherwise>
> 				</xsl:choose>
> 			</td>
> 			<td>
> 				<xsl:choose>
> 					<xsl:when
> test="boolean(string(Option))">
> 						<xsl:for-each
> select="Option">
>
> <xsl:value-of select="."/>
> 							<br/>
> 						</xsl:for-each>
> 					</xsl:when>
> 					<xsl:otherwise>&nbsp;
> 					</xsl:otherwise>
> 				</xsl:choose>
> 			</td>
> 			<td>
> 				<xsl:choose>
> 					<xsl:when
> test="boolean(string(Limit))">
> 						<xsl:for-each
> select="Limit">
>
> <xsl:value-of select="."/>
> 							<br/>
> 						</xsl:for-each>
> 					</xsl:when>
> 					<xsl:otherwise>&nbsp;
> 					</xsl:otherwise>
> 				</xsl:choose>
> 			</td>
> 		</tr>
> 		<xsl:if test="Property">
> 			<tr>
> 				<td colspan="7">
> 					<hr/>
> 				</td>
> 			</tr>
> 			<xsl:apply-templates select="Property"/>
> 			<tr>
> 				<td colspan="7">
> 					<hr/>
> 				</td>
> 			</tr>
> 		</xsl:if>
> 	</xsl:template>
> </xsl:stylesheet>
>
>
> The XML file is as follows:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <bpxml version="1.0" xmlns="http://www.todaysystems.com.au"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:schemaLocation="http://www.todaysystems.com.au
>
> BuildProObjects.xsd">
> 	<developer>
> 		<Component Name="DataDictionary">
> 			<Property Name="MaxLength" Required="True">
> 				<Description>Maximum number of
> characters that the field can hold. If
> occurrences are used the max length is 99.</Description>
> 				<Type>Number</Type>
> 				<Default>1</Default>
> 				<Limit>1 - 32000</Limit>
> 			</Property>
> 			<Property Name="Occurrences">
> 				<Description>Number of
> occurrences for this Dictionary object. Multiple
> occurrences, or subscripts, enable you to refer to a number
> of consecutive
> items using the same dictionary name.</Description>
> 				<Type>Number</Type>
> 				<Default>1</Default>
> 				<Limit>1 - 255</Limit>
> 			</Property>
> 			<Property Name="Description">
> 				<Property Name="Short">
> 					<Description>Short
> summary description using up to 20
> characters.</Description>
> 					<Type>Text</Type>
> 					<Default>Untitled</Default>
> 					<Limit>20 Chars</Limit>
> 				</Property>
> 				<Property Name="Long">
> 					<Description>A long
> description of the object.</Description>
> 					<Type>Text</Type>
> 					<Default>Untitled</Default>
> 					<Limit>180 Chars</Limit>
> 				</Property>
> 			</Property>
> 			<Property Name="LastModified">
> 				<Description>The last date and
> time the object was modified in the
> format CCYY-MM-DDThh-mm-ss</Description>
> 				<Type>DateTime</Type>
> 			</Property>
> 		</Component>
> 	</developer>
> </bpxml>
>
>
> Purnima Fernando
>
>
> Can't think of any reason for that, but it would help to know
> what's in your
> stylesheet and what XSLT processor and XML parser you are using.
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.