Delete child of a path
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Sun Dec 09, 2007 3:51 am
Delete child of a path
Hi,
i’m a beginner whit xslt then i need help.
I want to delete all elements son of the node Article that they aren’t except ‘PubModel’ and ‘ArticleDate’. I used the following code. It works but it doesn’t keep attributes in the resulting XML. Why? How can I do?
<xsl:template match="*|/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="//PubmedArticle/MedlineCitation/Article/*[name()!='PubModel'][name()!='ArticleDate']

i’m a beginner whit xslt then i need help.
I want to delete all elements son of the node Article that they aren’t except ‘PubModel’ and ‘ArticleDate’. I used the following code. It works but it doesn’t keep attributes in the resulting XML. Why? How can I do?
<xsl:template match="*|/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="//PubmedArticle/MedlineCitation/Article/*[name()!='PubModel'][name()!='ArticleDate']

-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
You did not specify in the XSLT stylesheet that you want to keep the attributes:
Regards,
Sorin
You did not specify in the XSLT stylesheet that you want to keep the attributes:
Code: Select all
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service