|
Subject: Re: [xsl] matching attribute values that are in range From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Wed, 19 Jul 2006 21:04:51 +0530 |
Hi Jeff, Please try this as well, and see if its useful for you.
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/root">
<root>
<xsl:for-each select="entry[(@n >=
substring-before($doc/root/entry/@n,'-')) and (@n <=
substring-after($doc/root/entry/@n,'-'))]">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:value-of select="concat(., ' ', $doc/root/entry)" />
</xsl:copy>
</xsl:for-each>
</root>
</xsl:template><root> <entry id='1' type='t' n='1'>some text</entry> <entry id='1' type='t' n='2'>some text</entry> <entry id='1' type='t' n='3'>some text</entry> <entry id='1' type='t' n='4'>some text</entry> <entry id='1' type='t' n='5'>some text</entry> </root>
<root> <entry id='1' type='t' n='3-4'>some text2</entry> </root>
<?xml version="1.0" encoding="UTF-8"?> <root> <entry id="1" type="t" n="3">some text some text2</entry> <entry id="1" type="t" n="4">some text some text2</entry> </root>
Regards, Mukul
hi!
i'm trying to match an element that may have an attribute value that is in a range format (1-5), and is located on a separate xml document; how can i get my xpath to match?
xml source:
<entry id='1' type='t' n='1'>some text</entry> <entry id='1' type='t' n='2'>some text</entry> <entry id='1' type='t' n='3'>some text</entry> <entry id='1' type='t' n='4'>some text</entry> <entry id='1' type='t' n='5'>some text</entry> xml source 2:
<entry id='1' type='t' n='1-5'>some text2</entry>
needed output:
<entry id='1' type='t' n='1'>some text some text2</entry> <entry id='1' type='t' n='2'>some text some text2</entry> <entry id='1' type='t' n='3'>some text some text2</entry> <entry id='1' type='t' n='4'>some text some text2</entry> <entry id='1' type='t' n='5'>some text some text2</entry>
thanks, --jeff
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] matching attribute values, Florent Georges | Thread | [xsl] Pleased help out at Extreme, Deborah Aleyne Lapey |
| [xsl] Pleased help out at Extreme, Deborah Aleyne Lapey | Date | RE: [xsl] Recursive counting, Michael Kay |
| Month |