이프온리님 xml/xsl 좀 도와 주세요 ㅠㅠ > 자유게시판

자유게시판

이프온리님 xml/xsl 좀 도와 주세요 ㅠㅠ 정보

이프온리님 xml/xsl 좀 도와 주세요 ㅠㅠ

본문


이프온리님 도와 주세요 ㅠㅠ

xml 소스에

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../dtd/speaking.xsl"?>
<!DOCTYPE speaking SYSTEM "../dtd/speaking.dtd">
<speaking ver="1.0">
 <step id="head">
  <title>head</title>

   <image id="lesson_head_div">
    
    <class>lesson_head_div</class>
    <src>../../images/bg/head_speaking.png</src>
    <alt></alt>
   </image>

 </step>
 <step id="1">
  <title>think</title>
  <activity id="SpeakingTest">
   <title>SpeakingTest</title>
   
   <video id="videoPlayer">
    
    <class></class>
    <src>../../mov/01Speaking_15page_video.mp4</src>
    <width>417</width>
   </video>
   
   <image id="btnPlay">
    
    <class></class>
    <src>../../images/common/play.png</src>
   </image>
   <image id="btnStop">
    
    <class>none</class>
    <src>../../images/common/stop.png</src>
   </image>
   
   <image id="btnTen">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_en.png</src>
    <alt>English</alt>
   </image>
   <image id="btnTko">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_ko.png</src>
    <alt>Korean</alt>
   </image>
   <image id="btnTenko">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_enko.png</src>
    <alt>English + Korean</alt>
   </image>
   
   <image id="btnTenko">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_enko.png</src>
    <alt>English + Korean</alt>
   </image>
   <image id="btnTenko">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_enko.png</src>
    <alt>English + Korean</alt>
   </image>
   
   <image id="btnFunctionListen">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_listen_off.png</src>
    <alt>Listrn and Repeat</alt>
   </image>
   <image id="btnFunctionRoleplay1">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_roleplay_1_off.png</src>
    <alt>Role Play 1</alt>
   </image>
   <image id="btnFunctionRoleplay2">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_roleplay_2_off.png</src>
    <alt>Role Play 2</alt>
   </image>
   <image id="btnFunctionTalk">
    
    <class></class>
    <src>../../images/teacher/btn_t_speaking_personaltalk_off.png</src>
    <alt>1:1 Talk</alt>
   </image>
   
   
   
   <textgroup id="comunication">
    <text>
     <![CDATA[Hello, <span class="red">May I speak to</span> Mike,Please?]]>
    </text>
    <text>
     <![CDATA[He is not here. <span class="red">May I ask</span> who's calling, please?]]>
    </text>
    <text>
     <![CDATA[This is Cathy with ABC Learning Center.]]>
    </text>
    <text>
     <![CDATA[Hi Cathy. <span class="red">Can I take a message?]]>
    </text>
    <text>
     <![CDATA[Sure. <span class="red">Could you ask</span> him <span class="red">to</span> return my call?]]>
    </text>  
    <text>
     <![CDATA[Ok. I will ask him to call you as soon as he comes home.]]>
    </text> 
    <text>
     <![CDATA[Thank you. Tell him to feel free to call me back anytime before 6pm.]]>
    </text>  
    <text>
     <![CDATA[Alright.]]>
    </text>                        
   </textgroup>
   
   
   <image id="reference">
    
    <class></class>
    <src>../../images/teacher/box_tool_reference_off.png</src>
    <alt>off</alt>
   </image>
   <image id="reference">
    
    <class></class>
    <src>../../images/teacher/box_tool_reference_off.png</src>
    <alt>off</alt>
   </image>
   <image id="reference">
    
    <class></class>
    <src>../../images/teacher/box_tool_reference_off.png</src>
    <alt>off</alt>
   </image>
   <image id="reference">
    
    <class></class>
    <src>../../images/teacher/box_tool_reference_off.png</src>
    <alt>off</alt>
   </image>
   <image id="reference">
    
    <class></class>
    <src>../../images/teacher/box_tool_reference_off.png</src>
    <alt>off</alt>
   </image>
   <text id="studentScore">(No Submit)</text>
   
  </activity>
  
  <activity id="Vocab">
   <title>Vocab Activity</title>
   <video id="VocabMainVideo">
    
    <class>video</class>
    <src>../../mainVideo.wmv</src>
    <width>320</width>
    <height>100</height>
    <alt>mainVideo</alt>
    <rel></rel>
   </video>
   <audio id="VocabMainAudio">
    
    <class>audio</class>
    <src>../../mainaudio.wmv</src>
    <alt>mainaudio</alt>
    <rel></rel>
   </audio>
   <audio id="VocabSubAudio">
    
    <class>audio</class>
    <src>../../subaudio.wmv</src>
    <alt>subaudio</alt>
    <rel></rel>
   </audio>
   
   <image id="VocabOnePageMainLeft">
    
    <class>image</class>
    <src>../../vocabonepagemainleft.jpg</src>
   </image>
      
   <image id="VocabOnePageMainRight">
    
    <class>image</class>
    <src>../../vocabonepagemainright.jpg</src>
   </image>
   
   <text id="oneleftside">안녕하세요!</text> 
   
   <text id="twoleftside">어쩌자고</text> 
   
   <quest pattern="a" id="1">
    <text>What's Your name???</text>
    <time>3:15</time>
    <example id="1">kim</example>
    <example id="2">song</example>
    <example id="3">park</example> 
    <example id="4">lee</example>     
   </quest> 
   
   <quest pattern="a" id="2">
    <text>What do you do???</text>
    <time>3:15</time>
    <example id="1">aaa</example>
    <example id="2">vvv</example>
    <example id="3">ccc</example> 
    <example id="4">kkk</example>     
   </quest>    
 
   <quest pattern="a" id="3">
    <text>what's your hobby???</text>
    <time>3:15</time>
    <example id="1">kim</example>
    <example id="2">song</example>
    <example id="3">park</example> 
    <example id="4">lee</example>     
   </quest> 
      
  </activity>
  
  <activity id="Prediction">
   
   <title>Prediction Activity</title>
   
   <video id="Prediction_MainV">
    
    <class>video</class>
    <src>../../mainVideo.wmv</src>
    <alt>mainVideo</alt>
    <rel></rel>
   </video>
   
   <audio id="Prediction_MainA">
    
    <class>audio</class>
    <src>../../mainaudio.wmv</src>
    <alt>mainaudio</alt>
    <rel></rel>
   </audio>
   
   <audio id="Prediction_SubA">
    
    <class>audio</class>
    <src>../../subaudio.wmv</src>
    <alt>subaudio</alt>
    <rel></rel>
   </audio>
  </activity> 
 </step>
</speaking>

위와 같이 step id="head" 와 step id="1" 로 나누고 있습니다.

xsl에서

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="speaking/step[@id='head']">

 <div>
  <xsl:attribute name="class">
    <xsl:value-of select="image/class" />
    </xsl:attribute>
  <img>
   <xsl:attribute name="src">
    <xsl:value-of select="image/src" />
   </xsl:attribute>
   <xsl:attribute name="alt">
    <xsl:value-of select="image/alt" />
   </xsl:attribute>
  </img>
 </div>

</xsl:template>

</xsl:stylesheet>

template match="speaking/step[@id='head']" 로 즉 id로 접근 하면

step = "1" 인 xml 녀석들이 텍스트로 다 출력 됩니다. ㅠㅠ

"head" 녀석들은 정상 스타일 시트가 먹히구요 ㅠㅠ 즉

안에서 템플릿 태그를 두번 쓰려고 해서 위와 같이 접근 하는데요 ㅠㅠ 왜 이런건가요.

물론

template match="speaking" 으로 잡고

각 안에서 value를 id로 접근해서 뽑아내면 밑에 Step="1" 내용이 안나와서

정상 출력 되긴 하는데요

아시면 부탁 드립니다. 맛난거 보내 드릴께요 ㅠㅠ 기프트콘으로 ㅋㅋ

한 xml 파일 안에 step 을 여러개 두고 한 step만 뽑아 내고 싶거든요 ㅠㅠ


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="speaking">

 <xsl:template match="/step[@id='head']">

  <div>
   <xsl:attribute name="class">
     <xsl:value-of select="image/class" />
     </xsl:attribute>
   <img>
    <xsl:attribute name="src">
     <xsl:value-of select="image/src" />
    </xsl:attribute>
    <xsl:attribute name="alt">
     <xsl:value-of select="image/alt" />
    </xsl:attribute>
   </img>
  </div>
  
 </xsl:template>
</xsl:template>

</xsl:stylesheet>

요렇게 탬플렛을 두번 싸면 안되더라구요 ㅠㅠ

<xsl:value-of select="image/alt" />
의 부모를  <xsl:template match="/step[@id='head']"> 말고
지정할 수 있나요?? 물론
<xsl:value-of select="step[@id='head']/image/alt" />
이렇게는 되겠지만 ㅠㅠ

그러면 각 리소스 마다 다 저렇게 접근 해야는 거잔요 ㅠㅠ

변수에도 담아서 해보고 다른거 다 찾아 봤는데 예제도 루트 엘리먼트를 지정하는건 없더라구요 ㅠㅠ

읽어 주셔서 감사합니다.


추천
0

댓글 6개

위 소스를 기반으로 하면 첫 xsl 소스에서
<xsl:template match="/">
<xsl:apply-templates select="speaking/step[@id='head']"/>
</xsl:template>
추가하시면 되실듯...
프리님 염치 정말 없습니다. ㅠㅠ 밑 처럼 하라시라는건지 ㅠㅠ

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/>

<xsl:apply-templates select="speaking/step[@id='head']"/>

 <div>
  <xsl:attribute name="class">
    <xsl:value-of select="image/class" />
    </xsl:attribute>
  <img>
  <xsl:attribute name="src">
    <xsl:value-of select="image/src" />
  </xsl:attribute>
  <xsl:attribute name="alt">
    <xsl:value-of select="image/alt" />
  </xsl:attribute>
  </img>
 </div>

</xsl:template>

</xsl:stylesheet>
프리님 염치 정말 없습니다. 아니면 ㅠㅠ 밑 처럼 하라시라는건지 ㅠㅠ

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/>

<xsl:apply-templates select="speaking/step[@id='head']" >

 <div>
  <xsl:attribute name="class">
    <xsl:value-of select="image/class" />
    </xsl:attribute>
  <img>
  <xsl:attribute name="src">
    <xsl:value-of select="image/src" />
  </xsl:attribute>
  <xsl:attribute name="alt">
    <xsl:value-of select="image/alt" />
  </xsl:attribute>
  </img>
 </div>
</xsl:apply-templates>
</xsl:template>

</xsl:stylesheet>
둘다 시타일 시트는 먹지 않고 XML 태그 내용을 문자열로만 가져 오네요. ㅠㅠ 죄송합니다. 지식 공유부탁 드립니다. ㅠㅠ 저도 열심히 찾아 보겠습니다. ㅠㅠ
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="speaking/step[@id='head']">
 <div>
  <xsl:attribute name="class">
    <xsl:value-of select="image/class" />
    </xsl:attribute>
  <img>
  <xsl:attribute name="src">
    <xsl:value-of select="image/src" />
  </xsl:attribute>
  <xsl:attribute name="alt">
    <xsl:value-of select="image/alt" />
  </xsl:attribute>
  </img>
 </div>
</xsl:template>

<xsl:template match="/">
    <xsl:apply-templates select="speaking/step[@id='head']"/>
</xsl:template>

</xsl:stylesheet>
오홀 정말 감사합니다 시원 스럽게 해결하였습니다. 저게 저렇게 쓰는 거였군요. 사례하겠습니다. 감사합니다. 혹시 지역이 어디신가요????
전체 199,644 |RSS
자유게시판 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT