Subject: RE: [xsl] generate-d( ) not working From: "John" <ahsan_hussain@xxxxxxxxxxxxx> Date: Thu, 31 Jul 2003 15:31:41 -0700 |
Thanks for your help, Mike, Wendell and Dave. I have tried to fix some of the redudancies. Maybe looking at my full XSL and XML files would convey better what i am trying to do. If you see the output, when i click on say textField_1, it takes me up to a portion in the page where i have the Name and Required attributes of textField_1. This is exactly how i want it to behave but i would like to put all this information down in the doc. after the HSDocumentation. So i would like all of this to be at the very end of my output HTML: Input Description: Name:textField_1 Required: true Name:textField_1_1 Required: true Name:textField_1_1_1 Required: true ---------------------------------------------------------------------------- ---- XML: ---------------------------------------------------------------------------- --- <HSContract contractCategory="2" contractName="myWebservice" contractType="3" expirationDate="Jun-23-2013" id="25_610_15006485306" limitMaxConcurrentThreads="false" logEnabled="true" maxConcurrentThreads="2" revision="25_11" runBatchInParallel="false" startDate="Jun-23-2003"> <imagePath /> <HSDataContainerType list="true" name="Inputs" required="true" revision="" systype="true"> <HSString name="textField_1" required="true" xmlNodeType="1" /> <HSInteger name="integerField_1" required="true" xmlNodeType="1" /> <HSDouble name="decimalField_1" required="true" xmlNodeType="1" /> <HSDate isCacheKey="false" name="dateField_1" required="true" xmlNodeType="1" /> <HSBinary binaryEncoding="0" name="binaryField_1" required="true" xmlNodeType="1" /> <HSBoolean name="trueFalseField_1" required="true" xmlNodeType="1"> <DefaultValue>false</DefaultValue> </HSBoolean> <HSDataContainerType name="DataContainer_1_1" required="true" revision=""> <HSString name="textField_1_1" required="true" xmlNodeType="1" /> <HSInteger name="integerField_1_1" required="true" xmlNodeType="1" /> <HSDataContainerType name="DataContainer_1_1_1" required="true" revision=""> <HSString name="textField_1_1_1" required="true" xmlNodeType="1" /> <HSInteger name="integerField_1_1_1" required="true" xmlNodeType="1" /> </HSDataContainerType> </HSDataContainerType> </HSDataContainerType> <HSDocumentation> <shortDescription><![CDATA[ The reality, though, is quite different. ]]></shortDescription> <descriptionSection title="myWebserviceDesc"><![CDATA[ VeriSign, which for small groups to build their own little island kingdoms. And their island kingdoms, which may not seem important or potent now, will be able to touch us more, not less. ]]></descriptionSection> <returnCodeDescription code="" /> </HSDocumentation> </HSContract> ---------------------------------------------------------------------------- ---- XSL: ---------------------------------------------------------------------------- --- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="HSContract"> <html> <head> <title/> </head> <body> <p><a href="#desc"><b>Contract Name: </b><xsl:value-of select="@contractName"/><br /></a> <b>ID: </b><xsl:value-of select="@id"/><br /> <b>Start Date: </b><xsl:value-of select="@startDate"/><br /></p> <xsl:apply-templates select="*"/> </body> </html> </xsl:template> <xsl:template name="HSDoc" match="HSDocumentation"> <p><a name="desc"><b>Short Description:</b><br /><br /></a> <xsl:apply-templates select="shortDescription" /><br /><br /> <b>Long Description:</b><br /><br /> <xsl:apply-templates select="descriptionSection" /></p> </xsl:template> <xsl:template name="shortDescription" match="//shortDescription"> <xsl:value-of select="text()"/> </xsl:template> <xsl:template name= "descriptionSection" match="//descriptionSection"> <xsl:value-of select="text()"/> </xsl:template> <xsl:template match="HSDataContainerType"> <b><img src="dcopenicon.gif"> <xsl:value-of select="@name"/></img><br /></b> <div style="margin-left: 3em;"> <xsl:apply-templates select="*"/></div> </xsl:template> <xsl:template match="*"> <div><xsl:apply-templates select="HSLink"/></div> <div><xsl:apply-templates select="HSDouble"/></div> <div><xsl:apply-templates select="HSInteger"/></div> <div><xsl:apply-templates select="HSDate"/></div> <div><xsl:apply-templates select="HSBinary"/></div> <div><xsl:apply-templates select="HSBoolean"/></div> </xsl:template> <xsl:template name="HSLink" match="//HSString"> <img src="texticon.gif"><a href="#{generate-id(.)}"> <xsl:value-of select="@name" /></a><br /></img> </xsl:template> <xsl:template name="HSLinker" match="*"><b>Input Description:</b><br /><br /> <xsl:for-each select="//HSString"> <a name="{generate-id(.)}"> Name:<xsl:value-of select="@name" /><br /> Required: <xsl:value-of select="@required" /></a><br /><br /> </xsl:for-each> </xsl:template> <xsl:template name="HSDouble" match="//HSDouble"> <img src="decimalicon.gif"><xsl:value-of select="@name"/></img><br /> </xsl:template> <xsl:template name="HSInteger" match="//HSInteger"> <img src="integericon.gif"><xsl:value-of select="@name"/></img><br /> </xsl:template> <xsl:template name="HSDate" match="//HSDataContainerType/HSDate"> <img src="dateicon.gif"><xsl:value-of select="@name"/></img><br /> </xsl:template> <xsl:template name="HSBinary" match="//HSBinary"> <img src="binaryicon.gif"><xsl:value-of select="@name"/></img><br /> </xsl:template> <xsl:template name="HSBoolean" match="//HSBoolean"> <img src="truefalseicon.gif"><xsl:value-of select="@name"/></img><br /> </xsl:template> </xsl:stylesheet> --------------------------------------------------------------------------- Any help or hints would be highly appreciated. Please let me know if you're still confused. Thanks, John Liebermann -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Wendell Piez Sent: Tuesday, July 01, 2003 2:43 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] generate-d( ) not working John, In your template > <xsl:template match="//HSS"> > <xsl:for-each select="."> > <a name="{generate-id(HSS)}"> > <xsl:value-of select="@name" /><br /> > <xsl:value-of select="@required" /></a><br /> > </xsl:for-each> > </xsl:template> the XPath in the expression "generate-id(HSS)" translates to "generate-id(child::HSS)". Since the HHS element that has been matched has no child HHS element, there's no node to get an ID for. Even if there were, it wouldn't be the right node. Try "generate-id(.)", short for "generate-id(self::node())", or just "generate-id()", which defaults to this. Same in the other template. Why the for-each? It's doing nothing but change the context node to what it already is (again, self::node()). Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] generate-d( ) not working, Wendell Piez | Thread | RE: [xsl] generate-d( ) not working, David Carlisle |
[xsl] generate-d( ) not working, John | Date | [xsl] XSL-List Guidelines, Mulberry Technologie |
Month |