1
xmlstarlet을 사용하여 속성 inkscape : label = "L2"가 포함 된 xml 파일의 요소를 찾고 속성 "style"을 설정하고 싶습니다. "display.inline"값으로 변경하십시오. 어려움은 "스타일"속성이 이미 정의되어 있거나 정의되어 있지 않을 수 있다는 것입니다. 속성 스타일이 이미 xmlstarlet : 속성이 존재하지 않으면 생성하고 편집하십시오.
// It works on this
<g inkscape:groupmode="layer"
id="layer2"
inkscape:label="L2"
style="display:none">
을 정의되어있는 경우
xmlstarlet edit --inplace --update "//*[@inkscape:label=\"L2\"]/@style" --value "display:inline" ex.svg
그것은 작동하지만, 그렇지 않으면 작동하지 않습니다 :
// Does not work
<g inkscape:groupmode="layer"
id="layer2"
inkscape:label="L2">
I를
나는 현재이 명령을 사용하고 또한 원하는 속성을 추가 할 수있는 명령을 정의했습니다.
속성이 이미 존재하는 경우xmlstarlet ed --insert "//*[@inkscape:label=\"L2\"]" --type attr -n style -v "display:inline" ex.svg > output.svg
불행하게도, 두 번째 하나가 추가됩니다
// The element now contains two attributes style
<g inkscape:groupmode="layer"
id="layer2"
inkscape:label="L2"
style="display:none"
style="display:inline">
존재하지 않는 그렇지 않으면 편집 할 경우 속성을 만들 수있는 방법이 있나요?