XML을 처음 사용하는 경우 XML 문서를 작성하고 Visual Studio를 사용하여 스키마를 자동 생성합니다. 나는 원래 내 자신의 스키마를 작성하기 시작했다. 내 질문에 구현할 수있는 결함이나 개선 사항이 있습니까? 유형, 요구 사항 및 발생 유효성 검사가 있습니다. 단지 궁금한 점이 있습니다.XML 스키마/XML 문서 구조 - 올바르게 작성 됨
XML
<?xml version="1.0" encoding="utf-8" ?>
<university>
<lesson id="ms434">
<subject>Biology</subject>
<maintopic name="Human Biology">
<subtopic>Enlarge Hearts</subtopic>
<subtopic>Heart Valves</subtopic>
</maintopic>
<content>
<sentance>Very long sentance one</sentance>
<sentance>Very long sentance two</sentance>
<sentance>Very long sentance three</sentance>
</content>
</lesson>
</university>
스키마
<?xml version="1.0" encoding="utf-8"?>
<xsl:template match="@* | node()">
<html>
<body>
<h1>Professional Training Facilities</h1>
<p>
<strong>University: </strong>
<xsl:for-each select="university/lesson">
<xsl:value-of select="subject"/>
</p>
<br/>
<p>
<strong>Main Topic: </strong>
<xsl:value-of select="maintopic=name"/>
</p>
<br/>
<p>
<strong>Sub Topics: </strong>
<xsl:for-each select="maintopic">
<p>
<xsl:value-of select="subtopic"/>
</p>
</xsl:for-each>
</p>
<p></p>
<strong>Content:</strong>
<xsl:for-each select="content">
<p>
<xsl:value-of select="sentance"/>
</p>
</xsl:for-each>
</xsl:for-each>
<br/>
</body>
</html>
</xsl:template>
필자는 스키마를 수동으로 거의 완료했을 때 코드가 적었을 것이라고 확신합니다. 자동 생성이 과도합니까?
편집 : 문제를 해결하는 첫 번째 문장에 대한 foreach 오류가 수정되었습니다.