[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Default template match
Thank you very much for the hint and sorry for that basic question... Regarding the second question, I paste my "/" template to explain the situation a little better. I have two source files: I cycle through the customers listed in the first "metadata" file and for each entry (customer) I output an element, which I compose in a way which is defined in the second file ("templates.xml" - OK, maybe this was a bad name choice...). Therefore, how can I refer to the specific customer (from the "metadata" file), when I am applying other templates? Thank you! Costantino ... <xsl:variable name="templates" select="'templates.xml'"/> <xsl:variable name="metadata" select="'metadata.xml'"/> <xsl:template match="/"> <xsl:element name="docs"> <xsl:for-each select="document($metadata)/data/doc"> <!-- select each requested doc/customer --> <xsl:element name="doc"> <xsl:element name="metadata"><xsl:copy-of select="./*"/></xsl:element > <xsl:element name="object"> <xsl:apply-templates select=" document($templates)/docs/doc[@label=current()/label and @lang=current()/customer/language]/object"> <!-- pass the metadata doc context as parameter (this is the "document request") --> <xsl:with-param name="doc-ref" select="current()"/> </xsl:apply-templates> </xsl:element> <!-- object --> <xsl:element name="content"> <xsl:apply-templates select=" document($templates)/docs/doc[@label=current()/label and @lang=current()/customer/language]/content"> <!-- pass the metadata doc context as parameter (this is the "document request") --> <xsl:with-param name="doc-ref" select="current()"/> </xsl:apply-templates> </xsl:element> <!-- content --> </xsl:element> <!-- doc --> </xsl:for-each> <!-- cycle through metadata's docs --> </xsl:element> <!-- docs --> </xsl:template> ---------------------------------------------------------------------- Date: Fri, 30 Nov 2001 16:41:17 GMT From: David Carlisle <davidc@xxxxxxxxx> Subject: Re: Default template match > <!-- HOW DO I AVOID TO USE THIS HORRIBLE ROW, EXCLUDING ALL OTHER TEMPLATES? --> > <xsl:template match="node()[name() != 'paste' and name() != 'object' and name() > != 'content' and name() != 'gender']"> JUST USE <xsl:template match="*"/> your other templates have higher priority so will be called when they apply. > <xsl:param name="doc-ref"/> move that to the top level of the stylesheet so it is a global parameter then you will not have to explictly pass it down. David 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
|