|
Subject: RE: [xsl] selecting elements depending on existence of attributes From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Fri, 4 May 2001 11:01:29 +0100 |
> There are some env-entry-name elements that have an attribute
> cols, some do
> not. If they have such an attribute, there could exist more than one
> env-entry-name elements with the same name as content.
I'm not sure I quite follow what you mean by "same name as content". But it
looks like a case for defining one template rule to handle each situation,
with a different match pattern for each. For example,
<xsl:template match="env-entry-name[@cols]">
...
</xsl:template>
<xsl:template match="env-entry-name[not(@cols)]">
...
</xsl:template>
>
> Now I want to include the different env-entry-value contents
> depending of
> the env-entry-name element cols attribute value, if there is
> not such an
> attribute, i.e. like in the third env-entry, the default content of
> env-entry-value should be included.
Sorry, I can't parse that sentence.
>
>
>
> My XSL looks like this at the moment:
I find it difficult to relate this to your problem description.
>
> --- snip ---
> <xsl:template name="include">
> <xsl:param name="key" />
> <xsl:variable name="includefile"
>
select="document('c:/dev/fbs/application/web/layouts/xml_to_jsp_include_02.x
ml')" />
The argument to document() must be a URI, not a filename.
> <xsl:value-of
> select="$includefile/properties/env-entry/env-entry-value[prec
> eding-sibling:
> :env-entry-name = $key and preceding-sibling::env-entry-name[@cols =
> $cols]]" disable-output-escaping="yes" />
Your code would be a lot simpler if you did this using xsl:apply-templates,
with different template rules for the different conditions.
You don't need preceding-sibling here: use something like
env-entry[env-entry-name[.=$key and @cols=$cols]/env-entry-value
What on earth is the disable-output-escaping for??
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] selecting elements depending , Sebastian Schirmer | Thread | Re: [xsl] URGENT help...XSL page ca, Peter Flynn |
| RE: [xsl] Substring Misunderstood?, Michael Kay | Date | Re: [xsl] RE: [xsl] RE: [xsl] Â / e, Wendell Piez |
| Month |