XSLT Search trough XML / Write Text without one specific element
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Wed May 09, 2018 2:08 pm
XSLT Search trough XML / Write Text without one specific element
Post by realbadfox »
Hallo Guys,
I have this code for searchgin through a XML and write it in an text file.
Every Element with every attribute and so on.
This is working perfect, but i want to write the same without one specific Element name, and without the child elements of it. So for example without the "STPDatenKFS" element end its childs.
XML:
XSLT:
OUTPUT:
please help me.
thanks yours chris
I have this code for searchgin through a XML and write it in an text file.
Every Element with every attribute and so on.
This is working perfect, but i want to write the same without one specific Element name, and without the child elements of it. So for example without the "STPDatenKFS" element end its childs.
XML:
Code: Select all
<DokumentenListe>
<Dokument>
<Typ TypID="Plan">Plan</Typ>
<Dateiname>xxx.pdf</Dateiname>
</Validierungsergebnis>
<STPPruefergebnis>fehlerfrei</STPPruefergebnis>
<kaMeStpVersion>1.2.4</kaMeStpVersion>
</Dokument>
<Dokument>
<Typ TypID="STPVaReport">STPVaReport</Typ>
<Dateiname>yyy.pdf</Dateiname>
<MimeType>application/pdf</MimeType>
<Link>yyy.pdf</Link>
</Dokument>
</DokumentenListe>
<STPDatenKFS>
<Metadaten Fehler="fehlerfrei">
<kaMeKgNr>12345</kaMeKgNr>
</Metadaten>
</TSTDaten>
</STPDatenKFS>
Code: Select all
<xsl:for-each select="/descendant-or-self::node()">
<xsl:choose>
<xsl:when test="self::*">
<xsl:for-each select="ancestor::*">
<xsl:text>AA</xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>BB</xsl:otherwise>
</xsl:choose>
<xsl:if test="self::*">
<span class="pre-elem">
<xsl:value-of select="local-name(.)"/>
</span>
<xsl:text>CC</xsl:text>
<xsl:for-each select="@*">
<span class="pre-attr">
<xsl:value-of select="local-name(.)"/>=<xsl:value-of select="."/>
</span>
<xsl:text>DD</xsl:text>
</xsl:for-each>
</xsl:if>
</xsl:if>
<xsl:if test="self::text()">
<span class="pre-text">
<xsl:value-of select="."/>
</span>
</xsl:if>
<xsl:if test="not(child::text())">
<xsl:text> EE</xsl:text>
</xsl:if>
</xsl:for-each>
Code: Select all
DokumentenListe
Dokument
Typ TypID=Plan Plan
Dateiname xxx.pdf
Validierungsergebnis
STPPruefergebnis fehlerfrei
kaMeStpVersion 1.2.4
Dokument
Typ TypID=STPVaReport STPVaReport
Dateiname yyy.pdf
MimeType application/pdf
Link yyy.pdf
STPDatenKFS
Metadaten Fehler=fehlerfrei
kaMeKgNr 12345
TSTDaten
thanks yours chris
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