,210 이 원하는 정확한 결과는 생성됩니다
1590593049,Extending Flash MX 2004,Using javascript alongwith actionscript 3.0 and mxml.
0132149184,Java Software Solutions,Complete book full of case studies on business solutions and design concepts while building mission critical business applications.
업데이트 : 코멘트에
영업 이익은 어떤이 텍스트에서 인용하고 (에 둘러싸여 쉼표 것을 요청했다 그 이후에 어떤 인용 부호가 두 개의 인용 부호로 바뀌고 마지막으로 결과에 인용 부호가 들어 있다면 (따옴표로 묶여 야합니다). 여기
이 생산하는 순수의 XPath 2.0 식입니다이 XPath 표현식은 XML 문서 (새로운 테스트 케이스로 확장)이에 대해 평가 for $b in /*/book,
$q in codepoints-to-string(34),
$NL in codepoints-to-string(10),
$isbn in normalize-space(replace($b/@isbn, ',', concat($q,',',$q))),
$t in normalize-space(replace($b/title, ',', concat($q,',',$q))),
$d in normalize-space(replace($b/description, ',', concat($q,',',$q))),
$res in
escape-html-uri(string-join(($isbn,$t,$d), ',')),
$res2 in replace($res, $q, concat($q,$q))
return
if(contains($res2, $q))
then concat($q, $res2, $q, $NL)
else concat($res2, $NL)
:
<books>
<book isbn="1590593049">
<title>Extending Flash MX 2004</title>
<description>
Using javascript alongwith actionscript 3.0 and mxml.</description>
</book>
<book isbn="0132149184">
<title>Java Software Solutions</title>
<description>
Complete book full of case studies on business solutions and design concepts while building mission critical
business applications.
</description>
</book>
<book isbn="XX1234567">
<title>Quotes and comma</title>
<description>
Hello, World from "Ms-Excel"
</description>
</book>
</books>
올바른 결과가 생성됩니다.
1590593049,Extending Flash MX 2004,Using javascript alongwith actionscript 3.0 and mxml.
0132149184,Java Software Solutions,Complete book full of case studies on business solutions and design concepts while building mission critical business applications.
"XX1234567,Quotes and comma,Hello"","" World from ""Ms-Excel"""
하지만 순수한 XPath 2 인 경우 줄 바꿈으로 ' '을 해석하지 않습니다 – BeniBela
@BeniBela, 질문이 명확하지 않습니다. 동일한 XPath 표현식을 사용하는 XSLT 변환. 합법적 인 XPath 표현식이 아닌 경우 오류가 발생하지만 변환은 아무런 문제없이 작동합니다. –
XSLT에 포함 시키면 더 이상 순수 * XPath가 아닙니다. 그런 다음 XML 구문 분석기가 & # xa를 대체합니다. XSLT없이 * pure * XPath를 실행하면 '1590593049, Flash MX 2004 확장, javascript와 함께 actionscript 3.0 및 mxml 사용. 0132149184, Java Software Solutions, 비즈니스 솔루션 및 디자인 개념에 대한 사례 연구가 가득한 책으로 비즈니스 핵심 응용 프로그램을 작성하십시오. '예 : – BeniBela