[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Let's say before that you have:
<xsl:variable name="text-1" select="foobar" />
You'll copy those foobar nodes out into your result doc.
Jon Gorman
Jon Gorman
Re: [xsl] Need help for XSL beautifaction
Subject: Re: [xsl] Need help for XSL beautifaction From: "Jon Gorman" <jonathan.gorman@xxxxxxxxx> Date: Tue, 16 May 2006 17:13:52 -0500 |
Do you have any ideas how I can code this XSL more beautiful:
<xsl:if test="textNo = 'text-1'" > <xsl:copy-of select="$text-1"/> </xsl:if>
In other words: Is there a chance to use the <copy-of> directly with the value of "textNo", without the <xsl:if> ?
Errr. I'm a little confused here. In this short example you've managed to create a short snippet that doesn't quite do what your short description says.
<xsl:if test="textNo = 'text-1'" > <xsl:copy-of select="$text-1"/> </xsl:if>
In other words, you're testing to see if the text value of textNo is text-1. If it is, you copy the node-set in the $text-1 variable or parameter.
Let's say before that you have:
<xsl:variable name="text-1" select="foobar" />
You'll copy those foobar nodes out into your result doc.
In other words: Is there a chance to use the <copy-of> directly with the value of "textNo", without the <xsl:if> ?
Well, according to your sippet, you already know textNo is 'textNo' in the if. If you don't care the about the value, why test it? Of course, you're not using the value of textNo anyhow. The literal answer to your question is: text-1
would replace <xsl:if test="textNo = 'text-1'" > <xsl:copy-of select="$text-1"/> </xsl:if>
I'm assuming you've made a mistake somewhere along the line. Or you have already simplified as much as you can.
Jon Gorman
I'm not entirely sure what your focus on "beautification" is here since it's pretty condensed already. Of course, in many cases a test for existance is unnecessary if what you are doing is copying the element itself or just checking for a certain value. But with your example we can't be sure of what's happening.
Jon Gorman
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Need help for XSL beautifacti, Christian Haase | Thread | Re: [xsl] Need help for XSL beautif, Wendell Piez |
Re: [xsl] two transformations conse, jimmy@xxxxxxxxxxxxxx | Date | Re: [xsl] Need help for XSL beautif, Wendell Piez |
Month |
Keywords