xslt에 대해 unparsed-text()를 수행하고 있습니다.일치하는 하위 문자열의 XSLT 그룹화
<xsl:template match="/" name="text2xml">
<xsl:variable name="entries" as="node()*">
<xsl:analyze-string select="$textfile" regex="\r\n?|\n">
<xsl:non-matching-substring>
<xsl:analyze-string select="." regex="someregcode">
<xsl:matching-substring>
<group>
<thistagwithsomeattributes>
<abc>some value coming from regex</abc>
<cde>some value from regex</cde>
</thistagwithsomeattributes>
</group>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:for-each-group select="$entries" group-by="abc">
<final>
<xsl:copy-of
select="current-group()[1]/abc,current-group()/*[not(self::abc)]"/>
</final>
</xsl:for-each-group>
을 위의 나를 위해 작동하지 않습니다 그래서 데이터는 다음과 같이
내가 matching-string
에서 그룹의 일부로서 요소 thistagwithsomeattributes
의 닫는 태그를 얻을 필요가 텍스트 파일에서오고있다 . 요소 thistagwithsomeattributes
을 제거하면 작동합니다. 이 요소를 일치하는 하위 문자열의 그룹에 포함시키는 방법 이 요소의 속성이 그룹에 대해 다른 값을 갖고 있기 때문에 나는이 필요
내가 (다음 XML 구조) 달성하기 위해 노력하고있어 :
<thistagwithsomeattributes att1="fromregexwithinggroup" att2="fromregexwithinggrouop">
<someelement>
<anothertagwithattributes att1="fromregexvalues">
<cont>
<itm>
abc>some value coming from regex</abc>
<cde>some value from regex</cde>
</itm>
</cont>
</anothertagwithattributes>
</thistagwithsomeattributes>
를 이제 입력 할 때 <thistagwithsomeattributes>
및 <anothertagwithattributes>
, 작동하지 않음 (결과 없음), xml 파일이 비어 있습니다. 하지만 내가 그들을 제거 할 때. 다음 결과를 얻었습니다.
"작동하지 않는다"고 말할 때 정확한 오류 메시지와 함께 문제를 재현 할 수 있도록 XML과 XSLT의 최소한이지만 완전한 예제를 게시하십시오. –
@Martin Honnen : 더 많은 샘플과 내가 성취하려고하는 것을 편집했습니다. 이전에 게시하지 않은 것에 대해 사과드립니다. – user726720