RE: [xsl]Select nodes without match

Subject: RE: [xsl]Select nodes without match
From: cknell@xxxxxxxxxx
Date: Thu, 24 Aug 2006 09:16:14 -0400
> Is there a command like a go-to in xsl for doing this?
Answer: No, "go-to" is from a different processing model. You'll need to find another means.

> if i make a template with match it destroy the object .cap 
Answer: No, it won't destroy anything.

You haven't shown us your XML, so I'll invent some that has the relevant properties and write an XLST template that should give you what you want.

------- INPUT DOCUMENT---------
<?xml version="1.0"?>
  <box id="ball.cap">Pittsburgh Pirates</box>
  <box id="pennant">Pittsburgh Pirates</box>

-------- STYLESHEET-------------
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="";>
  <xsl:strip-space elements="*" />
  <xsl:output method="xml" indent="yes" encoding="UTF-8" />

    <xsl:template match="/">
        <xsl:apply-templates />

    <xsl:template match="root-node">
        <xsl:apply-templates />

    <xsl:template match="box">
        <xsl:when test="ends-with(@id,'.cap')">
        	  <xsl:attribute name="width" select="'2%'" />
        	  <xsl:for-each select="@*">
        	    <xsl:if test="not(local-name(.) = 'id')">
        	      <xsl:copy-of select="." />
        	  <xsl:value-of select="." />
        <xsl:otherwise><xsl:copy-of select="." /></xsl:otherwise>


--------OUTPUT DOCUMENT-----------
<?xml version="1.0" encoding="UTF-8"?>
   <box width="2%">Pittsburgh Pirates</box>
   <box id="pennant">Pittsburgh Pirates</box>

Charles Knell
cknell@xxxxxxxxxx - email

-----Original Message-----
From:     <m.core@xxxxxxxxxxxxxxxx>
Sent:     Thu, 24 Aug 2006 12:15:37 +0200
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl]Select nodes without match

Hi all,
i have an xml tree and i need with xsl to be placed in a particular node without using the match statement.

For explain me well:
in the html version of the page i have a box in wich you can write; i need to resize that box and for doing this i write:

<xsl:when test="utils:endsWith(@id, '.cap')">
  <xsl:attribute name="width">2%</xsl:attribute>

but i need to place this code in a template that put me in the right nodes that contains .cap and i don't want this... How can i do?

thx for replies.

Current Thread