Subject: Problem with the document() function From: "Didier PH Martin" <martind@xxxxxxxxxxxxx> Date: Sun, 13 Feb 2000 13:25:49 -0500 |
Hi, I am jammed with a problem in a transformation sheet that uses the document() function. In a template , the <xsl:apply-templates select="document(@xlink:href)"/> tell the XSLT engine to parse and add the XML tree to the actual XML tree. This operation seems to be OK and the included document tree is inserted in the right element. In the XSLT transformation sheet, all elements that are not <xstyle:component....> elements are simply copied to the resultant output. The <xstyle:component...> element is converted into something else. The included document contains <xstyle:topic....> element that are to be transformed into something else too. The problem is that the content of the included XML document is copied but the <xstyle:topic..> elements are not transformed. I can't find the bug and maybe I too tired or do not see the obvious, but I do not see the faulty constructs. Here is (below this text) the XSLT transformation sheet. As you will notice, certain <xstyle:component...> elements trigger the processing of external documents. The problem is that these external documents contain <xstyle:netfolder...> or <xstyle:topic....> elements that are not processed by the <xsl:template match="xstyle:netfolder"> or the <xsl:template match="xstyle:topic[@xlink:type='simple']">, instead all elements of the included document are processed by the <xsl:template match="*|@*|text()"> template. many thanks for your help Didier PH Martin ---------------------------------------------- Email: martind@xxxxxxxxxxxxx Conferences: Web New York (http://www.mfweb.com) Book: XML Pro published by Wrox Press Products: http://www.netfolder.com <xsl:stylesheet exclude-result-prefixes = "xlink xstyle" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink/namespace/" xmlns:xstyle="http://www.talva.com/2000/xstyle"> <xsl:output method="xml" indent="yes"/> <xsl:template match="xstyle:component"> <xsl:choose> <!-- we embed the component's content only if the xlink:show attribute is set to 'show' --> <xsl:when test="contains(@xlink:show,'embed')"> <xsl:choose> <xsl:when test="contains(@xstyle:type,'image/svg')"> <embed type="image/svg"> <xsl:attribute name="src"><xsl:value-of select="./@xlink:href"/></xsl:attribute> <xsl:attribute name="height"><xsl:value-of select="./@xstyle:height"/></xsl:attribute> <xsl:attribute name="width"><xsl:value-of select="./@xstyle:width"/></xsl:attribute> </embed> </xsl:when> <xsl:when test="contains(@xstyle:type,'text/htm')"> <xsl:apply-templates select="document(@xlink:href)"/> </xsl:when> <xsl:when test="contains(@xstyle:type,'text/xml')"> <xsl:apply-templates select="document(@xlink:href,current())"/> </xsl:when> <!-- put here other xstyle formats identified by the xstyle:type attribute. An xstyle:type value is the component MIME type. For example, if the component is an SVG document, then its MIME type is image/svg. --> </xsl:choose> </xsl:when> <xsl:otherwise> <!-- We include an error message in the output document --> <xsl:comment>xstyle:component elements only support the xlink:show attribute set to the "embed" value.</xsl:comment> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="xstyle:netfolder"> <YOYO> <xsl:apply-templates/> </YOYO> </xsl:template> <xsl:template match="xstyle:topic[@xlink:type='simple']"> <ul> <li> <a> <xsl:attribute name="href"><xsl:value-of select="./@xlink:href"/></xsl:attribute> <xsl:value-of select="./@xlink:title"/> </a> <xsl:apply-templates/> </li> </ul> </xsl:template> <xsl:template match="*|@*|text()"> <xsl:copy> <xsl:apply-templates select="*|@*|text()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Didier PH Martin ---------------------------------------------- Email: martind@xxxxxxxxxxxxx Conferences: Web New York (http://www.mfweb.com) Book to come soon: XML Pro published by Wrox Press Products: http://www.netfolder.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: command line XSLT engine, Linda van den Brink | Thread | Re: Problem with the document() fun, Steve Tinney |
command line XSLT engine, Vincent Bernat | Date | Re: Problem with the document() fun, Steve Tinney |
Month |