[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
hi, prehaps it is not even a valid question, but i was wondering how i selectively use the data store in the xsl:template (not from the xml document but from an external xsl document)?
prehap it is easier to explain this with an example... suppose there are 2 xsl stylesheet (XSL1 and XSL2)
in XSL1 it contain the following: -
in XSL2 i will call the following template to retrieve the values store in the three key template: -
<xsl:template name="query_str">
<p><xsl:call-template name="key1"/></ip> and
<p><xsl:call-template name="key2"/></p> and <p><xsl:call-template name="key3"/></p> and </xsl:template>
so the output result should be: - <p>key234HrsWft</p> and <p>data</p> and <p>soome key</p>
the problem is, if key2 contain no data (ie <xsl:template name="key2"></xsl:template>) the output will becoming <p>key234HrsWft</p> and <p></p> and <p>soome key</p>
therefore, i was wondering, how could i selectively add the " and " string into the output file (e.g. only add the " and " string if key2 is not empty). i have tried using <xsl:if test="key2!=''"> but it does not work, so i was wondering is there are ways to get round this problem? any suggest would be a great help
Many thanks
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] about using templates
Subject: [xsl] about using templates From: "林 子芯" <minikittygo@xxxxxxxxxxx> Date: Tue, 11 Jun 2002 23:49:05 +0000 |
hi, prehaps it is not even a valid question, but i was wondering how i selectively use the data store in the xsl:template (not from the xml document but from an external xsl document)?
prehap it is easier to explain this with an example... suppose there are 2 xsl stylesheet (XSL1 and XSL2)
in XSL1 it contain the following: -
<xsl:template name="key1">fault/unit=key234HrsWft</xsl:template> <xsl:template name="key2">data</xsl:template> <xsl:template name="key3">some key</xsl:template>
in XSL2 i will call the following template to retrieve the values store in the three key template: -
<xsl:template name="query_str">
<p><xsl:call-template name="key1"/></ip> and
<p><xsl:call-template name="key2"/></p> and <p><xsl:call-template name="key3"/></p> and </xsl:template>
so the output result should be: - <p>key234HrsWft</p> and <p>data</p> and <p>soome key</p>
the problem is, if key2 contain no data (ie <xsl:template name="key2"></xsl:template>) the output will becoming <p>key234HrsWft</p> and <p></p> and <p>soome key</p>
therefore, i was wondering, how could i selectively add the " and " string into the output file (e.g. only add the " and " string if key2 is not empty). i have tried using <xsl:if test="key2!=''"> but it does not work, so i was wondering is there are ways to get round this problem? any suggest would be a great help
Many thanks
Regards Kit
_________________________________________________________________ 在您的行動裝置上傳送接收 Hotmail 郵件,請移至:http://mobile.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Name function and namespa, David Carlisle | Thread | Re: [xsl] about using templates, Peter Davis |
[xsl] XPath question, Wei-Chin Hsieh | Date | Re: [xsl] Name function and namespa, David Carlisle |
Month |