G
Greg Sandell
Suppose I have the following XML:
<root>
<homepage>
<title country="France">Welcome to our French friends:
Homepage</welcome>
<title country="England">Welcome to our English friends:
Homepage</welcome>
</homepage>
<aboutUsPage>
<title>Welcome to our Friends: About Us</title>
</aboutUsPage>
</root>
The idea here is that the home page has a country-specific title, and
the About Us page has one title for all countries. Imagine much more
XML with lots of other nodes marked up in this way.
What I want is an XSL template that will give me all the nodes that
are specific to a country, plus all the country-non-specific nodes.
Here is some pseudo XSL for what I would like to do (using an
English-specific example):
<xsl:template match="//node()[@country = 'England'] |
//node()[isnull(@country)]">
</xsl:template>
Of course, there is no such thing as an isnull() function. But is
there SOME way for me to detect nodes that lack a country attribute?
Any solution which does not require a change to my XML would be
appreciated. (i.e. I don't want to add "country=all" to the generic
nodes.)
Thanks,
Greg Sandell
<root>
<homepage>
<title country="France">Welcome to our French friends:
Homepage</welcome>
<title country="England">Welcome to our English friends:
Homepage</welcome>
</homepage>
<aboutUsPage>
<title>Welcome to our Friends: About Us</title>
</aboutUsPage>
</root>
The idea here is that the home page has a country-specific title, and
the About Us page has one title for all countries. Imagine much more
XML with lots of other nodes marked up in this way.
What I want is an XSL template that will give me all the nodes that
are specific to a country, plus all the country-non-specific nodes.
Here is some pseudo XSL for what I would like to do (using an
English-specific example):
<xsl:template match="//node()[@country = 'England'] |
//node()[isnull(@country)]">
</xsl:template>
Of course, there is no such thing as an isnull() function. But is
there SOME way for me to detect nodes that lack a country attribute?
Any solution which does not require a change to my XML would be
appreciated. (i.e. I don't want to add "country=all" to the generic
nodes.)
Thanks,
Greg Sandell