Subject: Re: [xsl] xsl elements in template not being interpreted by output as-is From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx> Date: Thu, 31 Mar 2011 13:08:26 +0200 |
Some of your namespace prefixes for stylesheet elements are xsl:, but a few are xsd: -W On 31 March 2011 12:58, Christian Schouten <C.Schouten@xxxxxxxxxx> wrote: > > Hi all, > > Sorry in advance if I'm overlooking the obvious, but I'm stuck here. > I've got an xsl file in which I created some templates. These templates > are called allright but the xsl elements inside of them aren't being > executed, but the xsl code is simply output to screen (I'm using Kernow > to test, final display preferably possible in IE for redistribution > purposes). > > The xsl should be called from an 'entrypoint' xsd file that will have > links to xml files (link:linkbaseRef, see below) and/or to xsd files > (xsd:import, see below) that in turn have their own xml files linked > (again, with link:linkbaseRef). From these xml files we'll go even > further exploring other (xsd) files, but I'm definitely not getting > there yet. > > XSL file: > ----- > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:link="http://www.xbrl.org/2003/linkbase" > xmlns:xlink="http://www.w3.org/1999/xlink"> > <!-- snip: global variables --> > <xsl:template match="/"> > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> > <!-- snip: html and css tags --> > Entrypoint <xsl:value-of > select="substring-after(xsd:schema/@targetNamespace, > concat($baseAddress, 'entrypoints/'))" /> > </p> > <p class="formsetHeader">Linkbases:<br/> > <xsl:apply-templates > select="/xsd:schema/xsd:annotation/xsd:appinfo/link:linkbaseRef" /></p> > <p class="formsetHeader">Schemas:<br/> > <xsl:apply-templates > select="/xsd:schema/xsd:import[starts-with(@namespace, > concat($baseAddress, 'report/'))]" /></p> > </body> > </html> > </xsl:template> > > <xsl:template match="xsd:import"> > I'm in: import-template > <xsl:variable name="schemaLocation" select="@schemaLocation" /> > <xsd:value-of select="$schemaLocation" /> <!-- should produce a value, > right? --> > <xsl:variable name="formsetschema" select="document($schemaLocation)" > /> > <xsd:value-of > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef/@xlink:href" /> <!-- another debug line --> > <xsd:apply-templates > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef" /> > </xsl:template> > > <xsl:template match="link:linkbaseRef"> > I'm in: linkbaseRef-template <!-- never gets here... --> > <xsl:variable name="href" select="@xlink:href" /> > <xsl:variable name="linkbase" select="document($href)" /> > <xsl:variable name="roleRef" > select="document(substring-before($linkbase/link:linkbase/link:roleRef/@ > xlink:href, '#'))" /> > <p class="formsetHeader"> > <xsl:value-of > select="substring-after($linkbase/link:linkbase/link:roleRef/@xlink:href > , '#')" />: > <xsl:value-of > select="$roleRef/xsd:schema/xsd:annotation/xsd:appinfo/link:roleType[@id > =substring-after($linkbase/link:linkbase/link:roleRef/@xlink:href, > '#')]/link:definition" /> > </p> > </xsl:template> > > </xsl:stylesheet> > ----- > > Now, instead of my expected output (main template linking to > import-template (which in turn links to linkbase-template) as well as > the linkbase-template if applicable) I see that the import-template is > correctly called, but nothing is interpreted, instead it shows the xsl > code as below: > ----- > Warning: at xsl:stylesheet on line 2 column 215 of > displayEntrypoint.xsl: > Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > <?xml version="1.0" encoding="UTF-8"?><html > xmlns:link="http://www.xbrl.org/2003/linkbase" > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> > <!-- snip: html/css --> > Entrypoint x > (...) > I'm in: import-template > <xsd:value-of select="$schemaLocation"/><xsd:value-of > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef/@xlink:href"/><xsd:apply-templates > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef"/> > I'm in: import-template > <xsd:value-of select="$schemaLocation"/><xsd:value-of > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef/@xlink:href"/><xsd:apply-templates > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef"/> > I'm in: import-template > <xsd:value-of select="$schemaLocation"/><xsd:value-of > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef/@xlink:href"/><xsd:apply-templates > select="$formsetschema/xsd:schema/xsd:annotation/xsd:appinfo/link:linkba > seRef"/></p></body></html> > > ----- > > Some sample lines taken from input files: > ----- > Entrypoint xsd: <xsd:import namespace="xyz" > schemaLocation="../myfile.xsd"></xsd:import> > Imported xsd: <link:linkbaseRef > xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" > xlink:href="linkbase.xml" > xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef" > xlink:title="Presentation Links, all" xlink:type="simple"/> > ----- > > > Any help most appreciated! > Thanks in advance, > Chris
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl elements in template , Martin Honnen | Thread | [xsl] Flat list to nested list,grou, Kjellaug Johansen |
Re: [xsl] xsl elements in template , Martin Honnen | Date | [xsl] Flat list to nested list,grou, Kjellaug Johansen |
Month |