xslt - Is it possible to select a node that just includes a subset of the child nodes? -


i have xpath:

//tbody/tr[2]/td/div/table/tbody/tr[2]/td[position() > 1] 

which gives me first child node. however, gives me nodelist of td notes result. want select parent tr node, first child td node removed.

is possible using xpath?

xpath query language xml documents. such cannot modify structure source xml document or create new xml document.

the task of creating new, modified document cannot done xpath only.

this easy accomplish xslt:

<xsl:stylesheet version="2.0"  xmlns:xsl="http://www.w3.org/1999/xsl/transform"  xmlns:xs="http://www.w3.org/2001/xmlschema">  <xsl:output omit-xml-declaration="yes" indent="yes"/>  <xsl:strip-space elements="*"/>   <xsl:template match="node()|@*">   <xsl:copy>    <xsl:apply-templates select="node()|@*"/>   </xsl:copy>  </xsl:template>   <xsl:template match="tr[2]/td[1]"/> </xsl:stylesheet> 

when transformation applied on following xml document:

<table>  <tr>   <td>1</td>   <td>2</td>   <td>3</td>  </tr>  <tr>   <td>1</td>   <td>2</td>   <td>3</td>   <td>4</td>  </tr> </table> 

the wanted, correct result (all nodes copied exception of 1st <td> child of second <tr>) produced:

<table>    <tr>       <td>1</td>       <td>2</td>       <td>3</td>    </tr>    <tr>       <td>2</td>       <td>3</td>       <td>4</td>    </tr> </table> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -