태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.
페이지를 읽고 있습니다. ( 아쿠아바다's Blog )
분류 전체보기 (769)
쉐어포인트 (24)
Exchange (12)
SQL (121)
XML (36)
WEB (294)
O / S (97)
삶의향기 (162)
기획 (19)
RSS 피드(IE 7.0부터 기본 지원됩니다. 이전 버전 사용자는 접합한 툴을 사용하세요!!)

xml데이타를 sorting

XML 2007/06/07 13:53 by 아쿠아바다

질문 내용


안녕하세요.. 정영탁입니다.

다음의 xml데이타를 아래와 같이 sorting할 수 있을까요>?

<?xml version="1.0" ?>
<matching>
    <other id="yourid1" percent="81" />
    <other id="yourid2" percent="16" />
    <other id="yourid3" percent="95" />
    <other id="yourid4" percent="81" />
    <other id="yourid5" percent="12" />
    <other id="yourid6" percent="45" />
    <other id="yourid7" percent="15" />
    <other id="yourid8" percent="81" />
    <other id="yourid9" percent="5" />
</matching>

위의 데이타를 percent에 따라서 ORDER BY DESC 시킬 수 있을까요?
msxml 4.0 sdk 도움말을 켜 놓고.. 아무리 찾아봐도 없네요...

<?xml version="1.0" ?>
<matching>
    <other id="yourid3" percent="95" />
    <other id="yourid1" percent="81" />
    <other id="yourid4" percent="81" />
    <other id="yourid8" percent="81" />
    <other id="yourid6" percent="45" />
    <other id="yourid2" percent="16" />
    <other id="yourid7" percent="15" />
    <other id="yourid5" percent="12" />
    <other id="yourid9" percent="5" />
</matching>

이거 참...힘드네요..^^;;
하면 할수록 재밌는데....
잘(?) 모르니... 진도가 잘 안나가고 더디네요..^^



답변 내용 :


xsl를 사용해서 출력을 했습니다.

xml 내용

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="test.xslt"?>
<matching>
    <other id="yourid1" percent="81" />
    <other id="yourid2" percent="16" />
    <other id="yourid3" percent="95" />
    <other id="yourid4" percent="81" />
    <other id="yourid5" percent="12" />
    <other id="yourid6" percent="45" />
    <other id="yourid7" percent="15" />
    <other id="yourid8" percent="81" />
    <other id="yourid9" percent="5" />
</matching>

xsl내용

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="matching">
  <ul>
    <xsl:apply-templates select="other">
      <xsl:sort data-type="number" order="descending" select="@percent"/>
    </xsl:apply-templates>
  </ul>
</xsl:template>


<xsl:template match="other">
  <li>
    <xsl:value-of select="@percent"/>
  </li>
</xsl:template>

</xsl:stylesheet>

그럼 ~:


출처 : ASP뉴스그룹 : 김병석

'XML' 카테고리의 다른 글

기상청 날씨정보  (0) 2007/06/07
트리뷰  (0) 2007/06/07
xml데이타를 sorting  (0) 2007/06/07
XML 싸이트  (0) 2007/06/07
VML관련  (0) 2007/06/07
액셀 내용을 XML 생성하기  (0) 2007/06/07
좀더 흥미로운 내용이 많이 있습니다.. HOME > XML를 확인하세요
TAG , ,   
0 Trackback, 0 Comment, :
1  ... 488 489 490 491 492 493 494 495 496  ... 769 
Statistics Graph
Total : 557,403 Today : 33