Groups | Blog | Home
all groups > dotnet xml > october 2003 >

dotnet xml : Filtered nodes with template/param, but xsl:number still counts them?


KatB
10/21/2003 4:37:54 PM
Hi, I posted this today on the xsl-list, but no takers so I thought I'd
try here. If nothing else, I would appreciate someone pointing me in the
right direction.

The following is just a portion of a longer template. I have varying
levels of <step> elements with potential customer and assembly
attributes. I select the <step>s I want (using the xsl:if and 2 params I
declare earlier), then need to create the variable "id" and number the
steps in my table -- applying numbers ONLY to those <step>s selected
with the IF test.

With the following structure, the numbering includes the
"unseen"/unselected elements. How can I do this please? If not possible
this way, would I have to FIRST filter the xml source into another file,
and THEN apply this stylesheet? I've never done that and can't find too
much info/examples. Any help greatly appreciated.

Thanks, Kat

<xsl:if test="(not(@customer) or (@customer=$customer)) and
(not(@assembly) or (@assembly=$assembly))">
<xsl:variable name="id">
<xsl:number level="multiple" count="step"
format="1.1"/>
</xsl:variable>

<table width="100%" border="0" cellpadding="0">
<tr>
<td valign="top">
<xsl:number level="multiple" count="step"
format="1.1"/>
<xsl:if test="not(ancestor::step)">
<xsl:text>.</xsl:text>
</xsl:if>
</td>
<td><xsl:apply-templates select="*[not(self::substeps)]"/>
</td></tr>

ETC...




Thanks, Kat

*** Sent via Developersdex http://www.developersdex.com ***
Oleg Tkachenko
10/22/2003 12:48:11 PM
[quoted text, click to view]
Set count attribute appropriatively to count only elements you need.

[quoted text, click to view]

<xsl:number level="multiple"
count="step[(not(@customer) or (@customer=$customer)) and
(not(@assembly) or (@assembly=$assembly))]" format="1.1"/>

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
AddThis Social Bookmark Button