XSLT를 처음 사용했습니다. 사용자 지정 COM 개체를 통해 XML 파일을 가져 오는 고전적인 ASP 페이지가 있습니다. 다음은 파일 구조입니다.XSLT 중첩 형식 그룹화
첫 번째 행에는 월 데이터 (인수 유형 = "2")가 포함 된 12 개의 행 다음에 연도 (인수 유형 = "1")와 관련된 값이 포함되어 있습니다. 생성해야하는 출력은 월 레코드를 표시하거나 숨길 수 있고 사용자 입력 대 XML 데이터를 기반으로 클라이언트 쪽 유효성 검사를 수행 할 수있는 텍스트 요소가있는 HTML 테이블입니다. 월 행을 표시하거나 숨기려면 (인수 유형 = "2") "연도"행 (인수 유형 = "1")이 항상 표시되고 첫 번째 테이블 셀에 "+"기호가 포함됩니다. 나는 이미 show/hide 및 validation Javascript 함수를 만들었습니다.
XSLT 파일 생성/형식 지정에 도움이 필요합니다. 결국, 나는 또한 설명이 포함 된 월 이름으로 월 수를 변환 할 필요가 고맙습니다
<row year="2016" type="1" euro="100000000.00"/>
<row year="2016" type="2" month="1"/>
<row year="2016" type="2" month="2"/>
<row year="2016" type="2" month="3"/>
<row year="2016" type="2" month="4"/>
<row year="2016" type="2" month="5"/>
<row year="2016" type="2" month="6"/>
<row year="2016" type="2" month="7" euro="1000234000.00"/>
<row year="2016" type="2" month="8"/>
<row year="2016" type="2" month="9"/>
<row year="2016" type="2" month="10"/>
<row year="2016" type="2" month="11"/>
<row year="2016" type="2" month="12"/>
<row year="2017" type="1" euro="199996993.00"/>
<row year="2017" type="2" month="1"/>
<row year="2017" type="2" month="2"/>
<row year="2017" type="2" month="3"/>
<row year="2017" type="2" month="4"/>
<row year="2017" type="2" month="5"/>
<row year="2017" type="2" month="6"/>
<row year="2017" type="2" month="7" euro="125000000.00"/>
<row year="2017" type="2" month="8"/>
<row year="2017" type="2" month="9"/>
<row year="2017" type="2" month="10"/>
<row year="2017" type="2" month="11"/>
<row year="2017" type="2" month="12"/>
여기가 갈 수있는 가장 좋은 방법 확실하지 내가 사용하고 코드는, 그러나 그것은 지금까지 일하고처럼 보인다
<xsl:for-each select="row">
<xsl:choose>
<xsl:when test="@type='1'>
<tr>
<td align="center">
<xsl:element name="a">
<xsl:attribute name="href">javascript:ToggleYear(<xsl:value-of select="@year"/>)</xsl:attribute>
<xsl:attribute name="id">a_<xsl:value-of select="@year"/></xsl:attribute>
<xsl:text>+</xsl:text>
</xsl:element>
</td>
<td>
...
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:if test="@type = 2">
<xsl:element name="tr">
<xsl:attribute name="style">display:none</xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="@year"/>_H_<xsl:value-of select="@month"/></xsl:attribute>
<td><xsl:text disable-output-escaping="yes">&</xsl:text>nbsp;</td>
<td>
...
</td>
</xsl:element>
</xsl:if>
</xsl:for-each>
에 오신 것을 환영합니다 SO 아주 폭 넓은 질문은 내가 생각 :-), 어쩌면 당신은 당신이 이미 가지고있는 코드를 보여주는를 편집 할 수 있습니다. –
고맙습니다 스테판, 코드를 업데이트했습니다 –
예상되는 HTML 출력을 보여주십시오. –