사용자 정의 XML 문서를 GraphML로 변환하기 위해 XSL 문서를 컴파일했습니다 (yEd Graph Editor에 대한 추가 메타 데이터가 있음). 변환은 예상대로 완료되고 완료되지만 한 가지 문제점이 있습니다. 변환을 수행하는 데 사용한 도구에 관계없이 결과 문서는 단일 행으로 구성되어 있으므로 변환을 수행 할 때마다 형식을 지정해야합니다. 내 질문 :XSLT에서 한 줄로 GraphML을 사용하는 XML 문서 변환
예쁜 XSL 문서를 인쇄하려면 어떻게하면 좋을까요? 내가 잘못 뭐하는 거지
또는
?
<?xml version="1.0"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd">
<key id="workerDescription" for="node" yfiles.type="nodegraphics"/>
<key for="edge" id="response" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="PathID">
<node id="PathID">
<data key="workerDescription">
<y:ShapeNode>
<y:Fill color="#FFCC00" transparent="false"/>
<y:NodeLabel>PathID</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
<edge source="PathID" target="PathID.EntryWorker"/>
<node id="PathID.EntryWorker">
<data key="workerDescription">
<y:ShapeNode alignment="center" autoSizePolicy="content" modelName="internal" modelPosition="c">
<y:NodeLabel>EntryWorker > EntryWorkerClass</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
<edge source="PathID.EntryWorker" target="PathID.MarkScoring" directed="true">
<data key="response">
<y:PolyLineEdge>
<y:EdgeLabel>SUCCESS</y:EdgeLabel>
<y:Arrows source="none" target="standard"/>
</y:PolyLineEdge>
</data>
</edge>
<edge source="PathID.EntryWorker" target="PathID.ERRORM" directed="true">
<data key="response">
<y:PolyLineEdge>
<y:EdgeLabel>ERROR</y:EdgeLabel>
<y:Arrows source="none" target="standard"/>
</y:PolyLineEdge>
</data>
</edge>
<node id="PathID.ERRORM">
<data key="workerDescription" transparent="false">
<y:ShapeNode alignment="center" autoSizePolicy="content" modelName="internal" modelPosition="c">
<y:Fill color="#FF0000"/>
<y:NodeLabel>ERRORM</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
<node id="PathID.MarkScoring">
<data key="workerDescription">
<y:ShapeNode alignment="center" autoSizePolicy="content" modelName="internal" modelPosition="c">
<y:NodeLabel>MarkScoring > MarkScoringClass</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
<edge source="PathID.MarkScoring" target="PathID.SUCCESS" directed="true">
<data key="response">
<y:PolyLineEdge>
<y:EdgeLabel>SUCCESS</y:EdgeLabel>
<y:Arrows source="none" target="standard"/>
</y:PolyLineEdge>
</data>
</edge>
<node id="PathID.SUCCESS">
<data key="workerDescription" transparent="false">
<y:ShapeNode alignment="center" autoSizePolicy="content" modelName="internal" modelPosition="c">
<y:Fill color="#FF0000"/>
<y:NodeLabel>SUCCESS</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
<edge source="PathID.MarkScoring" target="PathID.ERRORSCOR" directed="true">
<data key="response">
<y:PolyLineEdge>
<y:EdgeLabel>ERROR</y:EdgeLabel>
<y:Arrows source="none" target="standard"/>
</y:PolyLineEdge>
</data>
</edge>
<node id="PathID.ERRORSCOR">
<data key="workerDescription" transparent="false">
<y:ShapeNode alignment="center" autoSizePolicy="content" modelName="internal" modelPosition="c">
<y:Fill color="#FF0000"/>
<y:NodeLabel>ERRORSCOR</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
</graph>
</graphml>
난 :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paths SYSTEM "paths.dtd">
<paths>
<path id="PathID">
<entry-point name="start" worker-ref="EntryWorker" />
<worker id="EntryWorker" idref="EntryWorkerClass">
<response name="SUCCESS" worker-ref="MarkScoring" />
<response name="ERROR" exit="ERRORM" />
</worker>
<worker id="MarkScoring" idref="MarkScoringClass">
<response name="SUCCESS" exit="SUCCESS" />
<response name="ERROR" exit="ERRORSCOR" />
</worker>
</path>
</paths>
그리고 내 출력은 다음과 같다 :
<xsl:stylesheet version="1.0" encoding="UTF-8" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/paths">
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.yworks.com/xml/graphml"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd">
<key id="workerDescription" for="node" yfiles.type="nodegraphics"/>
<key for="edge" id="response" yfiles.type="edgegraphics"/>
<xsl:for-each select="path">
<graph edgedefault="directed">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
<node>
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
<data key="workerDescription">
<y:ShapeNode>
<y:Fill color="#FFCC00" transparent="false"/>
<y:NodeLabel>
<xsl:value-of select="@id"/>
</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
<xsl:for-each select="entry-point">
<edge>
<xsl:attribute name="source">
<xsl:value-of select="../@id"></xsl:value-of>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:value-of select="../@id"/>.<xsl:value-of select="@worker-ref"/>
</xsl:attribute>
</edge>
</xsl:for-each>
<xsl:for-each select="worker">
<node>
<xsl:attribute name="id">
<xsl:value-of select="../@id"/>.<xsl:value-of select="@id"/>
</xsl:attribute>
<data key="workerDescription">
<y:ShapeNode>
<xsl:attribute name="alignment">center</xsl:attribute>
<xsl:attribute name="autoSizePolicy">content</xsl:attribute>
<xsl:attribute name="modelName">internal</xsl:attribute>
<xsl:attribute name="modelPosition">c</xsl:attribute>
<y:NodeLabel>
<xsl:choose>
<xsl:when test="@idref = 'CallPath'">
<xsl:value-of select="@id"/> > <xsl:value-of select="context/value/map/entry/@value"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@id"/> > <xsl:value-of select="@idref"/>
</xsl:otherwise>
</xsl:choose>
</y:NodeLabel>
<xsl:if test="@idref = 'CallPath'">
<y:Fill color="#FFCC00" transparent="false"/>
</xsl:if>
</y:ShapeNode>
</data>
</node>
<xsl:for-each select="response">
<edge>
<xsl:attribute name="source">
<xsl:value-of select="../../@id"/>.<xsl:value-of select="../@id"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:value-of select="../../@id"/>.<xsl:value-of select="@worker-ref | @exit"/>
</xsl:attribute>
<xsl:attribute name="directed">true</xsl:attribute>
<data key="response">
<y:PolyLineEdge>
<y:EdgeLabel>
<xsl:value-of select="@name"/>
</y:EdgeLabel>
<y:Arrows source="none" target="standard"/>
</y:PolyLineEdge>
</data>
</edge>
<xsl:for-each select="@exit">
<node>
<xsl:attribute name="id">
<xsl:value-of select="../../../@id"/>.<xsl:value-of select="."/>
</xsl:attribute>
<data key="workerDescription" transparent="false">
<y:ShapeNode>
<xsl:attribute name="alignment">center</xsl:attribute>
<xsl:attribute name="autoSizePolicy">content</xsl:attribute>
<xsl:attribute name="modelName">internal</xsl:attribute>
<xsl:attribute name="modelPosition">c</xsl:attribute>
<y:Fill color="#FF0000"/>
<y:NodeLabel>
<xsl:value-of select="."/>
</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</graph>
</xsl:for-each>
</graphml>
</xsl:template>
</xsl:stylesheet>
내 입력은 다음과 같다 :
내 XSL 코드는 다음과 같다 메모장 ++ "XML 도구"플러그인을 사용하여 내 문서를 변환하고 서식을 지정합니다. 형식의 형식으로 XSLT 변환을 통합하려는 제안은 내 워크 플로 (프로그래밍 방식 또는 기타 방식)에 대한 결과를 환영합니다.
** 전체 ** 예를 게시하시기 바랍니다 입력과 예상 출력을 포함하여 - [mcve] 참조. –