find and output
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 1
- Joined: Sat Aug 01, 2015 12:59 pm
find and output
hi im new on oxygen xml editor using. i have a xml file contains 700+ items. and i want to find only specified label contains "GOO-*" text
input xml:
i want a file with only <barcode>label contains GOO-* text
what method is easy to use for this? and how can i do
thanks
input xml:
Code: Select all
<Urunler>
<Urun>
<Kod>356</Kod>
<Baslik><![CDATA[some text in here]]></Baslik>
<Durum>1</Durum>
<AltBaslik><![CDATA[]]></AltBaslik>
<barcode><![CDATA[GOO-024]]></barcode>
<Fiyat>175.000</Fiyat>
<ParaBirimi>TL</ParaBirimi>
<Miktar>0</Miktar>
<UrunOnayi><![CDATA[ yok ]]></UrunOnayi>
<Resim><![CDATA[some text in here]]></Resim>
<Aciklama><![CDATA[<span style="font-weight: bold;">some text in here]]></Aciklama>
<Kategori><![CDATA[El Aletleri]]></Kategori>
</Urun>
. . . . .
</Urunler>
what method is easy to use for this? and how can i do
thanks
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: find and output
HI,
You can apply this XSL stylesheet with Saxon 6.5.5 and obtain a copy of the XML that contains only the Urun entries that have a barcode with 'GOO-', the rest are filtered out.
Regards,
Adrian
You can apply this XSL stylesheet with Saxon 6.5.5 and obtain a copy of the XML that contains only the Urun entries that have a barcode with 'GOO-', the rest are filtered out.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="1.0">
<xsl:output method="xml" cdata-section-elements="Baslik AltBaslik barcode UrunOnayi Resim Aciklama Kategori"/>
<!-- Match document -->
<xsl:template match="/">
<xsl:apply-templates mode="copy" select="."/>
</xsl:template>
<!-- Deep copy template -->
<xsl:template match="node()|@*" mode="copy">
<xsl:copy>
<xsl:apply-templates mode="copy" select="@*"/>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
<!-- Handle default matching -->
<xsl:template match="*"/>
<xsl:template match="Urun" mode="copy">
<xsl:if test="contains(barcode/text(), 'GOO-')">
<xsl:copy>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Return to “General XML Questions”
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