xml에서 일반 텍스트를 가져오고 싶습니다. 어느 한 필드에 html data.i가 들어 있지 않으면 template.pls에 조건을 넣으십시오. 이 > 태그 다음에 모든 것을 반환 xslt를 사용하여 xml에서 html 태그를 제거하십시오.
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<workdetail>
<xsl:apply-templates select="*" />
</workdetail>
</xsl:template>
<xsl:template match="*:workdetail">
<xsl:variable name="text" select="*:field[starts-with(@name,'summaryText1')]"/>
<xsl:choose>
<xsl:when test="contains($text, '<')">
<xsl:value-of select="substring-after($text, '<')"/>
<xsl:variable name="text" select="substring-after($text, '>')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:stylesheet>
로
<?xml version="1.0" encoding="UTF-8"?>
<workdetail>
<field name="summaryText1"><UL style="MARGIN-TOP: 0in" type=disc>
<LI style="TEXT-ALIGN: justify;MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="mso-fareast-font-family: 'timesnewroman'; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-bidi-font-style: italic"><FONT size=2>Manage the daily activities of the HOD s office.<?xml:namespace prefix = o /><o:p></o:p></FONT></SPAN></LI>
<LI style="MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="mso-fareast-font-family: 'timesnewroman'; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-bidi-font-style: italic"><FONT size=2>Handle and manage all communication, correspondence and filing of documents. <o:p></o:p></FONT></SPAN></LI>
<LI style="MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="mso-fareast-font-family: 'timesnewroman'; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-bidi-font-style: italic"><FONT size=2>Fix appointments, arrange for meetings, conferences etc.<o:p></o:p></FONT></SPAN></LI>
</workdetail>
뮤 XSL 파일입니다. 이 텍스트 파일 만 반환 할 더 많은 가치를 전달할 수 있습니다.
게시 한 XML 입력 샘플에 대한 출력을 게시하는 것을 고려하십시오. 그리고 Saxon 9.5의 일부 버전은 구문 분석 작업을 수행 할 수있는 http://www.saxonica.com/documentation/index.html#!functions/saxon/parse-html을 사용하는 XSLT 2.0 프로세서를 알려주십시오. HTML은 쉽다. –
답장 martin에 대한 reply.i xslt2.0 프로세서 및 saxon9pe.jar 변환을 사용하고 있습니다. 예상 출력은 xml version = "1.0"encoding = "UTF-8"> HOD 사무실의 일상 활동 관리, 문서의 모든 통신, 서신 및 파일 처리 및 관리. 약속을 수정하고, 회의, 회의 등을 주선합니다. 그냥 모든 HTML 태그를 제거하고 싶습니다. –
user1906222