ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error
|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Matching on elements from namespaces
Hi everyone,
I've run across two interesting issues in matching elements from
namespaces. The end goal is to have several stylesheets, each of which
process elements from a particular namespace, and then have a master
stylesheet which imports these stylesheets.
For example, I might want an XHTML stylesheet and a MathML stylesheet
which when combined together will generate HTML from a mixed XHTML/MathML
document.
What I'm finding is that writing the XHTML stylesheet is cumbersome. With
the latest version of XT and the following source:
<html xmlns="http://www.w3.org/TR/xhtml1/strict">
<head>
<title>Example page</title>
</head>
<body>Some stuff</body>
</html>
I have to write a stylesheet like the following:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns:xhtml="http://www.w3.org/TR/xhtml1/strict">
<xsl:output method="html"/>
<xsl:template match="/xhtml:html/xhtml:body">
<xsl:copy-of select="text()|xhtml:*"/>
</xsl:template>
</xsl:stylesheet>
Note the nasty match and select expressions. Now according to XPath
section 2.3 Node Tests,
A QName in the node test is expanded into an expanded-name using
the namespace declarations from the
expression context. This is the same way expansion is done for
element type names in start and end-tags except that
the default namespace declared with xmlns is not used: if the
QName does not have a prefix, then the namespace
URI is null (this is the same way attribute names are expanded).
For future versions of XSLT/XPath, what do you feel should be the best way
to reduce the clutter? How about an inputns attribute, so I can write
something like:
<xsl:template match="/html/body" inputns="http://www.w3.org/TR/xhtml1/strict">
<xsl:copy-of select="text()|*"/>
</xsl:template>
or an input-prefix attribute:
<xsl:template match="/html/body" input-prefix="xhtml">
<xsl:copy-of select="text()|*"/>
</xsl:template>
The second issue relates to my desire for having a separate stylesheet per
namespace. Right now, both xsl:include and xsl:import must be top-level
elements. If I have several hundred namespaces this can get unwieldy and
so I would like to have a facility to include only those stylesheets which
are currently applicable to the document at hand. That is, perhaps a top
level element to indicate a mapping between namespace and stylesheet.
Comments?
. . . Sean.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








