|
Subject: Re: [xsl] Getting max/min numbers out of nested structure From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 10 Jun 2013 11:42:46 -0400 |
Given this nested structure (hope it comes through legibly): ... What is the easiest way to find the max/min box numbers in each <a>?
t:\ftemp>type michele.xml
<?xml version="1.0" encoding="UTF-8"?>
<test>
<a>
<b>
<box>1</box>
<box>1</box>
</b>
<b>
<box>1</box>
<box>2</box>
<c>
<box>2</box>
<box>2</box>
</c>
</b>
</a>
<a>
<b>
<box>3</box>
<box>4</box>
<c>
<box>6</box>
<box>6</box>
</c>
<box>5</box>
<box>5</box>
</b>
<b>
<box>5</box>
<box>5</box>
</b>
</a>
</test>t:\ftemp>xslt2 michele.xml michele.xsl 1 - 2 3 - 6
t:\ftemp>type michele.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<xsl:for-each select="test/a">
<xsl:value-of select="min(.//box),'-',max(.//box)"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template></xsl:stylesheet> t:\ftemp>
-- Contact us for world-wide XML consulting and instructor-led training | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: https://plus.google.com/116832879756988317389/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Getting max/min numbers o, Michele R Combs | Thread | Re: [xsl] Getting max/min numbers o, Martin Honnen |
| Re: [xsl] Getting max/min numbers o, Michael Kay | Date | Re: [xsl] Getting max/min numbers o, Martin Honnen |
| Month |